{"id":1569,"date":"2020-12-24T16:02:06","date_gmt":"2020-12-24T07:02:06","guid":{"rendered":"https:\/\/www.wetch.co.jp\/?p=1569"},"modified":"2022-01-14T23:20:15","modified_gmt":"2022-01-14T14:20:15","slug":"%e3%80%90tailwindcss%e3%80%91tailwindcss%e3%82%92nuxt-js%e3%81%ab%e7%b5%84%e3%81%bf%e8%be%bc%e3%82%93%e3%81%a7%e3%81%bf%e3%82%8b","status":"publish","type":"post","link":"https:\/\/www.wetch.co.jp\/note\/%e3%80%90tailwindcss%e3%80%91tailwindcss%e3%82%92nuxt-js%e3%81%ab%e7%b5%84%e3%81%bf%e8%be%bc%e3%82%93%e3%81%a7%e3%81%bf%e3%82%8b\/","title":{"rendered":"\u3010TailwindCSS\u3011TailwindCSS\u3092Nuxt.js\u306b\u7d44\u307f\u8fbc\u3093\u3067\u307f\u308b"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Nuxt\u74b0\u5883\u306bTailwindCSS\u3092\u7d44\u307f\u8fbc\u3080\u624b\u9806\u3081\u3082\u3067\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">TailwindCSS\u2026\u30e6\u30fc\u30c6\u30a3\u30ea\u30c6\u30a3\u30af\u30e9\u30b9\u3092\u63d0\u4f9b\u3059\u308bCSS\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3002<br>\u7528\u610f\u3055\u308c\u3066\u3044\u308bclass\u3092HTML\u306b\u5f53\u3066\u3066\u3044\u304f\u3060\u3051\u3067\u7c21\u5358\u306b\u30b9\u30bf\u30a4\u30eb\u304c\u8a2d\u5b9a\u3067\u304d\u307e\u3059\u3002<br>\u4f8b\uff1aclass=\u201cmt-10\u201d\u3000\u2192\u3000margin-top: 2.5rem; \u307f\u305f\u3044\u306a\u611f\u3058\u3002<br>\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u6027\u306e\u9ad8\u3055\u304c\u7279\u5fb4\u3002\u4e0b\u8a18\u306f\u516c\u5f0f\u30b5\u30a4\u30c8\u3002<br>\u516c\u5f0f\uff1a<a href=\"https:\/\/tailwindcss.com\/\">Tailwind CSS &#8211; Rapidly build modern websites without ever leaving your HTML.<\/a><\/p>\n\n\n\n<h2 class=\"has-cyan-bluish-gray-color has-text-color wp-block-heading\"><strong>\u7d44\u307f\u8fbc\u307f\u624b\u9806<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-bottom:-20px\">\u2460Nuxt\u74b0\u5883\u69cb\u7bc9\u3059\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npx create-nuxt-app my-project<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:-10px\">\u203bUIFramework\u3067Tailwind CSS\u3092\u9078\u629e\u3057\u306a\u3044\u3088\u3046\u306b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<br>\u4ee5\u524d\u306f\u3053\u306e\u6bb5\u968e\u3067\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3068\u3057\u3066Tailwind\u3092\u9078\u629e\u3057\u3066\u3044\u307e\u3057\u305f\u304c\u3001\u73fe\u5728\u306fmodule\u3068\u3057\u3066\u8aad\u307f\u8fbc\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-bottom:-20px\">\u203b\u3082\u3057\u65e2\u306bTailwindCSS\u306emodule\u306a\u3069\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3044\u308b\u5834\u5408\u306f\u30a2\u30f3\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm uninstall @nuxtjs\/tailwindcss tailwindcss<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:40px;margin-bottom:-20px\">\u2461\u65b0\u3057\u304fTailwindCSS\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm install -D @nuxtjs\/tailwindcss tailwindcss@npm:@tailwindcss\/postcss7-compat postcss@^7 autoprefixer@^9<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:-10px\">\u203bNuxt\u306fPostCSS8\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u306a\u3044\u305f\u3081\u3001\u4e0a\u8a18\u306e\u3088\u3046\u306bPostCSS7\u3092\u30d0\u30fc\u30b8\u30e7\u30f3\u6307\u5b9a\u3059\u308b\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:40px;margin-bottom:-20px\">\u2462next.config.js\u306ebuildModules\u306bTailwindCSS\u3092\u8a18\u8ff0\u3059\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  buildModules: &#91;\n    \u2018@nuxtjs\/tailwindcss\u2019\n  ],<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:40px;margin-bottom:-20px\">\u2463tailwind.config.js\u3092\u4f5c\u6210\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u3000npx tailwindcss init<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:40px;margin-bottom:-20px\">\u2464purge\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4f7f\u7528\u3059\u308b\u305f\u3081\u3001purge\u306e\u4e2d\u306b\u4e0b\u8a18\u3092\u8ffd\u52a0\u3002<br>\uff08TailwindCSS\u3092\u4f7f\u7528\u3057\u305f\u3044.vue\u30d5\u30a1\u30a4\u30eb\u304c\u5b58\u5728\u3059\u308b\u5168\u3066\u306e\u30d5\u30a9\u30eb\u30c0\u30d1\u30b9\u3092\u8a18\u8ff0\u3057\u3066\u304f\u3060\u3055\u3044\u3002\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>   purge: &#91;\n     \u2018.\/components\/**\/*.{vue,js}\u2019,\n     \u2018.\/layouts\/**\/*.vue\u2019,\n     \u2018.\/pages\/**\/*.vue\u2019,\n     \u2018.\/plugins\/**\/*.{js,ts}\u2019,\n     \u2018.\/nuxt.config.{js,ts}\u2019,\n   ],<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u203bPurgeCSS\u2026\u672a\u4f7f\u7528\u306eclass\u3092css\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u524a\u9664\u3057\u3066\u304f\u308c\u308b\u3002<br>TailwindCSS\u306f\u8272\u3005\u306aclass\u3092\u542b\u3093\u3067\u3044\u308b\u305f\u3081\u305d\u306e\u307e\u307e\u3067\u306f\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba\u304c\u80a5\u5927\u5316\u3057\u3066\u3057\u307e\u3046\u306e\u3067\u3001PurgeCSS\u3092\u8a2d\u5b9a\u3057\u3066\u3042\u3052\u308b\u3002<br>\u203bSCSS\u3092\u4f7f\u7528\u3059\u308b\u5834\u5408\u3001\uff06\u3067\u9023\u7d50\u3057\u305fclass\u540d\u3082\u524a\u9664\u3055\u308c\u3066\u3057\u307e\u3046\u306e\u3067\u6ce8\u610f\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-top:40px;margin-bottom:-20px\">\u2465assets\/css\/tailwind.css\u3092\u4f5c\u6210\u3057\u3001\u4e0b\u8a18\u3092\u8a18\u8ff0\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@import \u2018tailwindcss\/base\u2019;\n@import \u2018tailwindcss\/components\u2019;\n@import \u2018tailwindcss\/utilities\u2019;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"margin-bottom:-20px\">\u203b\u30b0\u30ed\u30fc\u30d0\u30eb\u306b\u4f7f\u3044\u305f\u3044\u5834\u5408\u306fnuxt.config.js\u306b\u4e0b\u8a18\u3092\u8ffd\u52a0\u3059\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>css: &#91;\n  \u2018~\/assets\/css\/tailwind.css\u2019,\n],<\/code><\/pre>\n\n\n\n<h2 class=\"has-cyan-bluish-gray-color has-text-color wp-block-heading\"><strong>\u6240\u611f<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>\u6700\u521d\u306f\u3061\u3087\u3063\u3068\u9762\u5012\u3067\u3057\u305f\uff01\u3044\u3061\u3044\u3061\u4e0b\u8a18\u30b5\u30a4\u30c8\u3088\u308a\u30b9\u30bf\u30a4\u30eb\u3092\u63a2\u3057\u3066\u5f53\u3066\u3066\u3044\u304b\u306a\u3051\u308c\u3070\u3044\u3051\u307e\u305b\u3093\u3002\u3002<br><a href=\"https:\/\/tailwindcss.com\/docs\">Documentation &#8211; Tailwind CSS<\/a><\/li><li>\u6163\u308c\u3066\u304f\u308b\u3068\u30b5\u30af\u30b5\u30af\u9032\u3081\u308b\u306e\u3067\u697d\u3057\u304f\u306a\u3063\u3066\u304d\u307e\u3059\u3002\u3002<\/li><li>\u3069\u3046\u3057\u3066\u3082HTML\u306e\u30af\u30e9\u30b9\u540d\u306f\u5197\u9577\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u304c\u3001Nuxt\u3060\u3068\u305d\u3093\u306a\u306b\u6c17\u306b\u306a\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u666e\u901a\u306eHTML\u306b\u5f53\u3066\u3066\u3044\u304f\u5206\u306b\u306f\u597d\u307f\u304c\u5206\u304b\u308c\u305d\u3046\u3067\u3059\u3002\u3002<\/li><li>\u64ec\u4f3c\u8981\u7d20\uff08before\/after\uff09\u3078\u306e\u30af\u30e9\u30b9\u5f53\u3066\u304c\u51fa\u6765\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u3002\u3002<br>\u64ec\u4f3c\u8981\u7d20\u5c02\u7528\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u304c\u3042\u308b\u3088\u3046\u3067\u3059\u3002\u4eca\u5f8c\u7d44\u307f\u8fbc\u3093\u3067\u4f7f\u3063\u3066\u307f\u305f\u3044\u3067\u3059\u3002<br><a href=\"https:\/\/github.com\/croutonn\/tailwindcss-pseudo-elements\">https:\/\/github.com\/croutonn\/tailwindcss-pseudo-elements<\/a><\/li><li>\u4eca\u5f8c\u306e\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u304c\u697d\u305d\u3046\u3060\u306a\u3001\u3068\u8a00\u3046\u306e\u304c\u4e00\u756a\u5927\u304d\u306a\u3068\u3053\u308d\u3067\u3059\u3002HTML\u306e\u30af\u30e9\u30b9\u306e\u4ed8\u3051\u5916\u3057\u3060\u3051\u3067\u6b86\u3069\u30b9\u30bf\u30a4\u30eb\u8abf\u6574\u3067\u304d\u3066\u3057\u307e\u3046\u306e\u3067\u3001\u3042\u308a\u304c\u3061\u306a\u300c\u5171\u901a\u30b9\u30bf\u30a4\u30eb\u3092\u4fee\u6b63\u3057\u3066\u3057\u307e\u3044\u3001\u77e5\u3089\u306a\u3044\u5185\u306b\u5225\u306e\u3068\u3053\u308d\u306b\u5f71\u97ff\u304c\u51fa\u305f\u300d\u304c\u306a\u304f\u306a\u308a\u307e\u3059\u3002\u81ea\u524d\u3067\u7ba1\u7406\u3059\u308bCSS\u306e\u91cf\u3082\u6e1b\u308b\u306e\u3067\u898b\u901a\u3057\u3082\u826f\u304f\u306a\u308a\u305d\u3046\u3002\u3002<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Nuxt\u74b0\u5883\u306bTailwindCSS\u3092\u7d44\u307f\u8fbc\u3080\u624b\u9806\u3081\u3082\u3067\u3059\u3002 TailwindCSS\u2026\u30e6\u30fc\u30c6\u30a3\u30ea\u30c6\u30a3\u30af\u30e9\u30b9\u3092\u63d0\u4f9b\u3059\u308bCSS\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3002\u7528\u610f\u3055\u308c\u3066\u3044\u308bclass\u3092HTML\u306b\u5f53\u3066\u3066\u3044\u304f\u3060\u3051\u3067\u7c21\u5358\u306b\u30b9\u30bf\u30a4\u30eb\u304c\u8a2d\u5b9a\u3067\u304d\u307e\u3059\u3002 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1604,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_wp_rev_ctl_limit":""},"categories":[214],"tags":[24,37,45,74],"class_list":["post-1569","post","type-post","status-publish","format-standard","has-post-thumbnail","category-214","tag-web","tag-javascript","tag-css","tag-nuxt"],"_links":{"self":[{"href":"https:\/\/www.wetch.co.jp\/note\/wp-json\/wp\/v2\/posts\/1569","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wetch.co.jp\/note\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wetch.co.jp\/note\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wetch.co.jp\/note\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wetch.co.jp\/note\/wp-json\/wp\/v2\/comments?post=1569"}],"version-history":[{"count":0,"href":"https:\/\/www.wetch.co.jp\/note\/wp-json\/wp\/v2\/posts\/1569\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wetch.co.jp\/note\/wp-json\/wp\/v2\/media\/1604"}],"wp:attachment":[{"href":"https:\/\/www.wetch.co.jp\/note\/wp-json\/wp\/v2\/media?parent=1569"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wetch.co.jp\/note\/wp-json\/wp\/v2\/categories?post=1569"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wetch.co.jp\/note\/wp-json\/wp\/v2\/tags?post=1569"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}