{"id":96,"date":"2022-07-03T11:34:00","date_gmt":"2022-07-03T02:34:00","guid":{"rendered":"http:\/\/52.196.21.54.nip.io\/techblog\/?p=96"},"modified":"2022-06-13T10:40:12","modified_gmt":"2022-06-13T01:40:12","slug":"%e4%ba%ba%e3%81%8b%e3%82%89%e3%82%82%e3%82%89%e3%81%a3%e3%81%9f-import-layout-%e3%81%bf%e3%81%9f%e3%81%84%e3%81%aaglob%e3%81%aesass%e3%82%92%e3%82%b3%e3%83%b3%e3%83%91%e3%82%a4%e3%83%ab","status":"publish","type":"post","link":"https:\/\/shugomatsuzawa.com\/techblog\/2022\/07\/03\/96\/","title":{"rendered":"\u4eba\u304b\u3089\u3082\u3089\u3063\u305f @import &#8220;layout\/**&#8221;; \u307f\u305f\u3044\u306aglob\u306eSass\u3092\u30b3\u30f3\u30d1\u30a4\u30eb\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"\n<p>Sass\uff08SCSS\uff09\u306e\u66f8\u304d\u65b9\u3084\u74b0\u5883\u306f\u4eba\u306b\u3088\u3063\u3066\u7d50\u69cb\u9055\u3046\u3068\u601d\u3046\u3002<br>\u5148\u65e5\u3001\u4eba\u304b\u3089\u3082\u3089\u3063\u305fSass\u3092\u30b3\u30f3\u30d1\u30a4\u30eb\u3057\u305f\u3089\u6b21\u306e\u30a8\u30e9\u30fc\u304c\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Error: Can't find stylesheet to import.\n  \u2577\n4 \u2502 @import \"init\/**\";\n  \u2502 ^^^^^^^^^\n  \u2575<\/code><\/pre>\n\n\n\n<p>\u672c\u4eba\u306b\u805e\u3044\u305f\u3089Gulp\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u4f7f\u3063\u3066\u3044\u308b\u3089\u3057\u3044\u306e\u3067\u3001\u540c\u3058\u74b0\u5883\u3092\u4f5c\u3063\u3066\u307f\u305f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Gulp\u306e\u5c0e\u5165<\/h2>\n\n\n\n<p>\u307e\u305aNode.js\u3068NPM\u304c\u4f7f\u3048\u308b\u3088\u3046\u306b\u3057\u3066\u304a\u304f\u3002<br>\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30d5\u30a9\u30eb\u30c0\u3092\u958b\u304d\u3001<code>npm init<\/code>\u3067\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u4f5c\u6210\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm init<\/code><\/pre>\n\n\n\n<p>\u5fc5\u8981\u306a\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm install -D gulp sass gulp-sass gulp-sass-glob<\/code><\/pre>\n\n\n\n<p>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30d5\u30a9\u30eb\u30c0\u76f4\u4e0b\u306b\u3001\u6b21\u306e\u3088\u3046\u306a<code>gulpfile.js<\/code>\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3002<br>\u203b\u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30b9\u306a\u3069\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u66f8\u304d\u63db\u3048\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ gulp\u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u8aad\u307f\u8fbc\u307f\nconst gulp = require(\"gulp\");\nconst sass = require(\"gulp-sass\")(require(\"sass\"));\nconst sassGlob = require(\"gulp-sass-glob\");\n\n\/\/ \u30bf\u30b9\u30af\u4f5c\u6210\ngulp.task(\"default\", () => {\n  return (\n    gulp\n      .src(\"scss\/style.scss\") \/\/ scss\u30d5\u30a1\u30a4\u30eb\u53d6\u5f97\n      .pipe(sassGlob()) \/\/ glob\u3092\u6709\u52b9\u306b\u3059\u308b\n      .pipe(sass()) \/\/ \u30b3\u30f3\u30d1\u30a4\u30eb\n      .pipe(gulp.dest(\"css\")) \/\/ css\u30d5\u30a9\u30eb\u30c0\u30fc\u4ee5\u4e0b\u306b\u4fdd\u5b58\n  );\n});<\/code><\/pre>\n\n\n\n<p>\u30bf\u30b9\u30af\u306e\u5b9f\u884c\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npx gulp<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u30d2\u30f3\u30c8<\/h2>\n\n\n\n<p><code>gulpfile.js<\/code>\u3067\u306f\u3001\u3053\u3093\u306a\u611f\u3058\u3067\u30aa\u30d7\u30b7\u30e7\u30f3\u304c\u6307\u5b9a\u3067\u304d\u308b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>...\n\ngulp.task(\"default\", function() {\n  return (\n    gulp\n      .src(\"scss\/style.scss\")\n      .pipe(sass({outputStyle: \"expanded\"})) \/\/outputStyle\u3067\u51fa\u529b\u30b3\u30fc\u30c9\u6210\u5f62\n      .pipe(gulp.dest(\"css\"))\n  );\n});<\/code><\/pre>\n\n\n\n<p>\u4ed6\u306e\u4eba\u3068\u5171\u540c\u7de8\u96c6\u3059\u308b\u3068\u304d\u306f\u3001<code>gulpfile.js<\/code>\u3001<code>package.json<\/code>\u3001<code>package-lock.json<\/code>\u3092\u4e00\u7dd2\u306b\u6e21\u3057\u3066\u304a\u304f\u3068\u3001\u540c\u3058\u74b0\u5883\u3067\u4f5c\u696d\u3067\u304d\u308b\u306e\u3067\u5b89\u5fc3\u3060\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u53c2\u8003<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/qiita.com\/tonkotsuboy_com\/items\/67d9fd4d054a45af9f34\">Sass\u306e\u8907\u6570\u306eimport\u306fglob\u3092\u4f7f\u3063\u3066\u4e00\u3064\u306b\u307e\u3068\u3081\u308b\u3068\u5e78\u305b &#8211; Qiita<\/a><\/li><li><a rel=\"noreferrer noopener\" href=\"https:\/\/ics.media\/entry\/3290\/\" data-type=\"URL\" data-id=\"https:\/\/ics.media\/entry\/3290\/\" target=\"_blank\">\u7d76\u5bfe\u3064\u307e\u305a\u304b\u306a\u3044Gulp 4\u5165\u9580(2022\u5e74\u7248) &#8211; \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3068Sass\u3092\u4f7f\u3046\u307e\u3067\u306e\u624b\u9806 &#8211; ICS MEDIA<\/a><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"Sass\uff08SCSS\uff09\u306e\u66f8\u304d\u65b9\u3084\u74b0\u5883\u306f\u4eba\u306b\u3088\u3063\u3066\u7d50\u69cb\u9055\u3046\u3068\u601d\u3046\u3002\u5148\u65e5\u3001\u4eba\u304b\u3089\u3082\u3089\u3063\u305fSass\u3092\u30b3\u30f3\u30d1\u30a4\u30eb\u3057\u305f\u3089\u6b21\u306e\u30a8\u30e9\u30fc\u304c\u3002 \u672c\u4eba\u306b\u805e\u3044\u305f\u3089Gulp\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u4f7f\u3063\u3066\u3044\u308b\u3089\u3057\u3044\u306e\u3067\u3001\u540c\u3058\u74b0\u5883\u3092\u4f5c\u3063\u3066\u307f\u305f\u3002 Gulp\u306e\u5c0e\u5165 [&hellip;]","protected":false},"author":1,"featured_media":99,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":3,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[47],"tags":[50,49,13,14,48,10],"class_list":["post-96","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-frontend","tag-css","tag-gulp","tag-node-js","tag-npm","tag-sass","tag-memo"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/shugomatsuzawa.com\/techblog\/wp-content\/uploads\/sites\/3\/2022\/06\/coding-g2157659b5_1920.jpg","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/shugomatsuzawa.com\/techblog\/wp-json\/wp\/v2\/posts\/96","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shugomatsuzawa.com\/techblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/shugomatsuzawa.com\/techblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/shugomatsuzawa.com\/techblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/shugomatsuzawa.com\/techblog\/wp-json\/wp\/v2\/comments?post=96"}],"version-history":[{"count":4,"href":"https:\/\/shugomatsuzawa.com\/techblog\/wp-json\/wp\/v2\/posts\/96\/revisions"}],"predecessor-version":[{"id":102,"href":"https:\/\/shugomatsuzawa.com\/techblog\/wp-json\/wp\/v2\/posts\/96\/revisions\/102"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/shugomatsuzawa.com\/techblog\/wp-json\/wp\/v2\/media\/99"}],"wp:attachment":[{"href":"https:\/\/shugomatsuzawa.com\/techblog\/wp-json\/wp\/v2\/media?parent=96"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shugomatsuzawa.com\/techblog\/wp-json\/wp\/v2\/categories?post=96"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shugomatsuzawa.com\/techblog\/wp-json\/wp\/v2\/tags?post=96"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}