質問編集履歴
12
タイトル名のgulpのバージョンを追記
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
【追記】gulpを使用して同階層でdestフォルダにsassとpugを自動コンパイルさせたい
|
1
|
+
【追記】gulp4を使用して同階層でdestフォルダにsassとpugを自動コンパイルさせたい
|
test
CHANGED
File without changes
|
11
マルチポスト先のURL間違いを修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -790,7 +790,7 @@
|
|
790
790
|
|
791
791
|
### マルチポスト先
|
792
792
|
|
793
|
-
[スタックオーバー](https://stacke
|
793
|
+
[スタックオーバー](https://ja.stackoverflow.com/users/34049/wa)
|
794
794
|
|
795
795
|
|
796
796
|
|
10
スタックオーバーで質問したものは全てこの質問に属します
test
CHANGED
File without changes
|
test
CHANGED
@@ -788,6 +788,12 @@
|
|
788
788
|
|
789
789
|
|
790
790
|
|
791
|
+
### マルチポスト先
|
792
|
+
|
793
|
+
[スタックオーバー](https://stackexchange.com/users/15803793/wa?tab=inbox)
|
794
|
+
|
795
|
+
|
796
|
+
|
791
797
|
|
792
798
|
|
793
799
|
ここにより詳細な情報を記載してください。
|
9
試したことを追記しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -338,7 +338,7 @@
|
|
338
338
|
|
339
339
|
*/
|
340
340
|
|
341
|
-
function browser
|
341
|
+
function browsersync() {
|
342
342
|
|
343
343
|
browserSync({
|
344
344
|
|
@@ -754,9 +754,21 @@
|
|
754
754
|
|
755
755
|
・gulpfile.jsのwatch部分の記述を変更
|
756
756
|
|
757
|
-
・
|
757
|
+
・以下のサイトに従ってパッケージのgulpをアップデートするが
|
758
|
+
|
758
|
-
|
759
|
+
package.jsonではgulp 4.01
|
760
|
+
|
759
|
-
|
761
|
+
コマンドプロンプトでgulp -vをするとなぜか
|
762
|
+
|
763
|
+
CLI version 2.1.0
|
764
|
+
|
765
|
+
Local version 3.9.1
|
766
|
+
|
767
|
+
となってしまう
|
768
|
+
|
769
|
+
https://kenyo--c.com/css/1572/
|
770
|
+
|
771
|
+
|
760
772
|
|
761
773
|
|
762
774
|
|
8
タグの追加
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|
7
タイトル変更
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
【追記】gulpを使用して同階層でdestフォルダにsassを自動コンパイル
|
1
|
+
【追記】gulpを使用して同階層でdestフォルダにsassとpugを自動コンパイルさせたい
|
test
CHANGED
File without changes
|
6
初心者マークを付与
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|
5
追記完了
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
gulp
|
1
|
+
【追記】gulpを使用して同階層でdestフォルダにsassを自動コンパイルするとエラーになる
|
test
CHANGED
@@ -754,6 +754,8 @@
|
|
754
754
|
|
755
755
|
・gulpfile.jsのwatch部分の記述を変更
|
756
756
|
|
757
|
+
・このフォルダに対してgulpをアップデート
|
758
|
+
|
757
759
|
|
758
760
|
|
759
761
|
|
4
表記が崩れていたので修正しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -536,7 +536,7 @@
|
|
536
536
|
|
537
537
|
include /_includes/_script
|
538
538
|
|
539
|
-
|
539
|
+
```
|
540
540
|
|
541
541
|
|
542
542
|
|
3
新たにエラーが出たのでgulpfile.jsとpackage.jsonを変更しました。文字数がオーバーしたのでmeta.pugは消去しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
### 前提・実現したいこと
|
2
2
|
|
3
|
+
【実現したいこと】
|
4
|
+
|
5
|
+
pug、css、sassを同階層でdestフォルダにリアルタイムで自動コンパイルと
|
6
|
+
|
7
|
+
cssファイルはコピーさせること
|
8
|
+
|
9
|
+
|
10
|
+
|
3
11
|
【問題】
|
4
12
|
|
5
13
|
js,gulpに関して初心者です。
|
@@ -18,8 +26,6 @@
|
|
18
26
|
|
19
27
|
|
20
28
|
|
21
|
-
|
22
|
-
|
23
29
|
【参考サイト】
|
24
30
|
|
25
31
|
https://www.tam-tam.co.jp/tipsnote/html_css/post10973.html
|
@@ -34,15 +40,55 @@
|
|
34
40
|
|
35
41
|
### 発生している問題・エラーメッセージ
|
36
42
|
|
37
|
-
|
43
|
+
```エラー
|
44
|
+
|
38
|
-
|
45
|
+
gulp.task('default', gulp.series(gulp.parallel(html, sass_style, css, js), gulp.series(browsersync, watchFiles)));
|
46
|
+
|
47
|
+
^
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
TypeError: gulp.parallel is not a function
|
52
|
+
|
53
|
+
at Object.<anonymous> (C:\Users\Documents\pug-sass-test\gulpfile.js:139:39)
|
54
|
+
|
55
|
+
at Module._compile (internal/modules/cjs/loader.js:701:30)
|
56
|
+
|
57
|
+
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
|
58
|
+
|
59
|
+
at Module.load (internal/modules/cjs/loader.js:600:32)
|
60
|
+
|
61
|
+
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
|
62
|
+
|
63
|
+
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
|
64
|
+
|
65
|
+
at Module.require (internal/modules/cjs/loader.js:637:17)
|
66
|
+
|
67
|
+
at require (internal/modules/cjs/helpers.js:22:18)
|
68
|
+
|
69
|
+
at Liftoff.handleArguments (C:\Users\Documents\pug-sass-test\node_modules\gulp\bin\gulp.js:116:3)
|
70
|
+
|
71
|
+
at Liftoff.execute (C:\Users\Documents\pug-sass-test\node_modules\liftoff\index.js:203:12)
|
72
|
+
|
73
|
+
npm ERR! code ELIFECYCLE
|
74
|
+
|
75
|
+
npm ERR! errno 1
|
76
|
+
|
77
|
+
npm ERR! gulp-pug-test@1.0.0 start: `gulp`
|
78
|
+
|
79
|
+
npm ERR! Exit status 1
|
80
|
+
|
81
|
+
npm ERR!
|
82
|
+
|
39
|
-
!
|
83
|
+
npm ERR! Failed at the gulp-pug-test@1.0.0 start script.
|
84
|
+
|
40
|
-
|
85
|
+
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
|
41
|
-
|
42
|
-
|
86
|
+
|
87
|
+
|
88
|
+
|
43
|
-
|
89
|
+
```
|
44
|
-
|
45
|
-
|
90
|
+
|
91
|
+
|
46
92
|
|
47
93
|
|
48
94
|
|
@@ -114,7 +160,7 @@
|
|
114
160
|
|
115
161
|
'css': 'src/**/*.css',
|
116
162
|
|
117
|
-
'sass': ['src/**/*.scss', '!' + 'src/**/_*.scss'],
|
163
|
+
'sass_style': ['src/**/*.scss', '!' + 'src/**/_*.scss'],
|
118
164
|
|
119
165
|
//'styleguideWatch': 'src/**/*.scss',
|
120
166
|
|
@@ -226,7 +272,7 @@
|
|
226
272
|
|
227
273
|
*/
|
228
274
|
|
229
|
-
function sass() {
|
275
|
+
function sass_style() {
|
230
276
|
|
231
277
|
const plugins = [flexBugsFixes(), autoprefixer()];
|
232
278
|
|
@@ -268,17 +314,13 @@
|
|
268
314
|
|
269
315
|
|
270
316
|
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
317
|
/**
|
276
318
|
|
277
319
|
* jsファイルをdestディレクトリに出力(コピー)します。
|
278
320
|
|
279
321
|
*/
|
280
322
|
|
281
|
-
|
323
|
+
function js() {
|
282
324
|
|
283
325
|
return gulp.src(src.js, {base: src.root})
|
284
326
|
|
@@ -286,7 +328,7 @@
|
|
286
328
|
|
287
329
|
.pipe(browserSync.reload({stream: true}));
|
288
330
|
|
289
|
-
}
|
331
|
+
}
|
290
332
|
|
291
333
|
|
292
334
|
|
@@ -296,7 +338,7 @@
|
|
296
338
|
|
297
339
|
*/
|
298
340
|
|
299
|
-
|
341
|
+
function browser-sync() {
|
300
342
|
|
301
343
|
browserSync({
|
302
344
|
|
@@ -310,7 +352,7 @@
|
|
310
352
|
|
311
353
|
});
|
312
354
|
|
313
|
-
}
|
355
|
+
};
|
314
356
|
|
315
357
|
|
316
358
|
|
@@ -320,19 +362,21 @@
|
|
320
362
|
|
321
363
|
*/
|
322
364
|
|
323
|
-
|
365
|
+
function watchFiles(done) {
|
324
|
-
|
366
|
+
|
325
|
-
gulp.watch(src.html, gulp.
|
367
|
+
gulp.watch(src.html).on('change', gulp.series(html, browserReload));
|
368
|
+
|
326
|
-
|
369
|
+
gulp.watch(src.scss).on('change', gulp.series(sass_style, browserReload));
|
370
|
+
|
371
|
+
gulp.watch(src.css).on('change', gulp.series(css, browserReload));
|
372
|
+
|
327
|
-
gulp.watch(src.sc
|
373
|
+
gulp.watch(src.js).on('change', gulp.series(js, browserReload));
|
328
|
-
|
329
|
-
|
374
|
+
|
330
|
-
|
331
|
-
|
375
|
+
}
|
332
|
-
|
376
|
+
|
377
|
+
|
378
|
+
|
333
|
-
|
379
|
+
gulp.task('default', gulp.series(gulp.parallel(html, sass_style, css, js), gulp.series(browsersync, watchFiles)));
|
334
|
-
|
335
|
-
});
|
336
380
|
|
337
381
|
|
338
382
|
|
@@ -348,8 +392,6 @@
|
|
348
392
|
|
349
393
|
|
350
394
|
|
351
|
-
|
352
|
-
|
353
395
|
```
|
354
396
|
|
355
397
|
### index.pug
|
@@ -496,103 +538,7 @@
|
|
496
538
|
|
497
539
|
|
498
540
|
|
499
|
-
|
541
|
+
|
500
|
-
|
501
|
-
### _meta.pug
|
502
|
-
|
503
|
-
```pug
|
504
|
-
|
505
|
-
meta(charset="UTF-8")
|
506
|
-
|
507
|
-
meta(http-equiv="X-UA-Compatible" content="IE=edge")
|
508
|
-
|
509
|
-
meta(name="viewport" content="width=device-width, initial-scale=1.0")
|
510
|
-
|
511
|
-
meta(name="format-detection" content="telephone=no")
|
512
|
-
|
513
|
-
if pageTitle
|
514
|
-
|
515
|
-
title #{pageTitle} | #{site.name}
|
516
|
-
|
517
|
-
else
|
518
|
-
|
519
|
-
title #{site.name}
|
520
|
-
|
521
|
-
meta(name="description" content=pageDescription)
|
522
|
-
|
523
|
-
meta(name="keywords" content=pageKeywords)
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
block css
|
528
|
-
|
529
|
-
link(rel="stylesheet" href="/assets/css/base/reset.css")
|
530
|
-
|
531
|
-
link(rel="stylesheet" href="/assets/css/base/common.css")
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
//- OGP
|
536
|
-
|
537
|
-
if pageOgpTitle
|
538
|
-
|
539
|
-
meta(property="og:title" content=pageOgpTitle + ' | ' + site.name)
|
540
|
-
|
541
|
-
else
|
542
|
-
|
543
|
-
meta(property="og:title" content=site.name)
|
544
|
-
|
545
|
-
meta(property="og:type" content=pageOgpType)
|
546
|
-
|
547
|
-
meta(property="og:image" content=pageOgpImage)
|
548
|
-
|
549
|
-
meta(property="og:url" content=site.rootUrl + pageUrl)
|
550
|
-
|
551
|
-
meta(property="og:description" content=pageDescription)
|
552
|
-
|
553
|
-
meta(property="og:site_name" content=site.name)
|
554
|
-
|
555
|
-
meta(property="og:locale" content=pageLang)
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
//- OGP Facebook insights
|
560
|
-
|
561
|
-
meta(property="fb:admins" content="")
|
562
|
-
|
563
|
-
meta(property="fb:app_id" content="")
|
564
|
-
|
565
|
-
//- /OGP Facebook insights
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
//- OGP Twitter Cards
|
570
|
-
|
571
|
-
meta(name="twitter:card" content="summary")
|
572
|
-
|
573
|
-
meta(name="twitter:site" content="@")
|
574
|
-
|
575
|
-
//- /OGP Twitter Cards
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
//- /OGP
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
```
|
584
|
-
|
585
|
-
### _scriput.pug
|
586
|
-
|
587
|
-
```pug
|
588
|
-
|
589
|
-
block js
|
590
|
-
|
591
|
-
script(src="/assets/js/common.js")
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
```
|
596
542
|
|
597
543
|
|
598
544
|
|
@@ -756,23 +702,23 @@
|
|
756
702
|
|
757
703
|
"devDependencies": {
|
758
704
|
|
759
|
-
"browser-sync": "^2.26.
|
705
|
+
"browser-sync": "^2.26.4",
|
760
|
-
|
706
|
+
|
761
|
-
"gulp": "^
|
707
|
+
"gulp": "^4.0.1",
|
762
|
-
|
708
|
+
|
763
|
-
"gulp-autoprefixer": "^6.
|
709
|
+
"gulp-autoprefixer": "^6.1.0",
|
764
710
|
|
765
711
|
"gulp-clean-css": "^4.0.0",
|
766
712
|
|
767
713
|
"gulp-data": "^1.3.1",
|
768
714
|
|
769
|
-
"gulp-notify": "^
|
715
|
+
"gulp-notify": "^3.2.0",
|
770
716
|
|
771
717
|
"gulp-plumber": "^1.2.1",
|
772
718
|
|
773
719
|
"gulp-postcss": "^8.0.0",
|
774
720
|
|
775
|
-
"gulp-pug": "^
|
721
|
+
"gulp-pug": "^4.0.1",
|
776
722
|
|
777
723
|
"gulp-rename": "^1.4.0",
|
778
724
|
|
@@ -786,10 +732,6 @@
|
|
786
732
|
|
787
733
|
}
|
788
734
|
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
735
|
```
|
794
736
|
|
795
737
|
|
@@ -798,7 +740,7 @@
|
|
798
740
|
|
799
741
|
|
800
742
|
|
801
|
-
gulpのバージョン違いによるものかと考えたので
|
743
|
+
・gulpのバージョン違いによるものかと考えたので
|
802
744
|
|
803
745
|
参考サイトに従い、変更すべきところを変更しました。
|
804
746
|
|
@@ -806,7 +748,13 @@
|
|
806
748
|
|
807
749
|
|
808
750
|
|
809
|
-
変数名が間違えているのかチェック
|
751
|
+
・変数名が間違えているのかチェック
|
752
|
+
|
753
|
+
・package.jsonのアップデート
|
754
|
+
|
755
|
+
・gulpfile.jsのwatch部分の記述を変更
|
756
|
+
|
757
|
+
|
810
758
|
|
811
759
|
|
812
760
|
|
2
概要を追記
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
gulpfile.jsのsassでエラーに
|
1
|
+
gulpfile.jsのsassでエラーになる
|
test
CHANGED
@@ -14,6 +14,8 @@
|
|
14
14
|
|
15
15
|
肉付けしていきました。
|
16
16
|
|
17
|
+
sassを入れる前はpugなど、全て自動コンパイルが出来ていました。
|
18
|
+
|
17
19
|
|
18
20
|
|
19
21
|
|
1
ディレクトリ構造、他のファイル情報を追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -34,328 +34,760 @@
|
|
34
34
|
|
35
35
|
|
36
36
|
|
37
|
+

|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
【log】
|
42
|
+
|
43
|
+

|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
### ディレクトリ構造
|
48
|
+
|
49
|
+

|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
### gulpfile.jsのソースコード
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
```JavaScript
|
58
|
+
|
59
|
+
const gulp = require('gulp');
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
//pug
|
64
|
+
|
65
|
+
const pug = require('gulp-pug');
|
66
|
+
|
67
|
+
const fs = require('fs');
|
68
|
+
|
69
|
+
const data = require('gulp-data');
|
70
|
+
|
71
|
+
const path = require('path');
|
72
|
+
|
73
|
+
const plumber = require('gulp-plumber');
|
74
|
+
|
75
|
+
const notify = require('gulp-notify');
|
76
|
+
|
77
|
+
const browserSync = require('browser-sync');
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
//css
|
82
|
+
|
83
|
+
const sass = require('gulp-sass');
|
84
|
+
|
85
|
+
const sassGlob = require('gulp-sass-glob');
|
86
|
+
|
87
|
+
const postcss = require('gulp-postcss');
|
88
|
+
|
89
|
+
const flexBugsFixes = require('postcss-flexbugs-fixes');
|
90
|
+
|
91
|
+
const autoprefixer = require('gulp-autoprefixer'); //Sassにベンダープレフィックスをつける
|
92
|
+
|
93
|
+
const rename = require('gulp-rename'); //ファイルをリネーム
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
/**
|
98
|
+
|
99
|
+
* 開発用のディレクトリを指定します。
|
100
|
+
|
101
|
+
*/
|
102
|
+
|
103
|
+
const src = {
|
104
|
+
|
105
|
+
// 出力対象は`_`で始まっていない`.pug`ファイル。
|
106
|
+
|
107
|
+
'html': ['src/**/*.pug', '!' + 'src/**/_*.pug'],
|
108
|
+
|
109
|
+
// JSONファイルのディレクトリを変数化。
|
110
|
+
|
111
|
+
'json': 'src/_data/',
|
112
|
+
|
113
|
+
'css': 'src/**/*.css',
|
114
|
+
|
115
|
+
'sass': ['src/**/*.scss', '!' + 'src/**/_*.scss'],
|
116
|
+
|
117
|
+
//'styleguideWatch': 'src/**/*.scss',
|
118
|
+
|
119
|
+
'js': 'src/**/*.js'
|
120
|
+
|
121
|
+
};
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
/**
|
126
|
+
|
127
|
+
* 出力するディレクトリを指定します。
|
128
|
+
|
129
|
+
*/
|
130
|
+
|
131
|
+
const dest = {
|
132
|
+
|
133
|
+
'root': 'dest/',
|
134
|
+
|
135
|
+
'html': 'dest/'
|
136
|
+
|
137
|
+
};
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
/**
|
142
|
+
|
143
|
+
* `.pug`をコンパイルしてから、destディレクトリに出力します。
|
144
|
+
|
145
|
+
* JSONの読み込み、ルート相対パス、Pugの整形に対応しています。
|
146
|
+
|
147
|
+
*/
|
148
|
+
|
149
|
+
function html() {
|
150
|
+
|
151
|
+
// JSONファイルの読み込み。
|
152
|
+
|
153
|
+
var locals = {
|
154
|
+
|
155
|
+
'site': JSON.parse(fs.readFileSync(src.json + 'site.json'))
|
156
|
+
|
157
|
+
}
|
158
|
+
|
159
|
+
return gulp.src(src.html)
|
160
|
+
|
161
|
+
// コンパイルエラーを通知します。
|
162
|
+
|
163
|
+
.pipe(plumber({errorHandler: notify.onError("Error: <%= error.message %>")}))
|
164
|
+
|
165
|
+
// 各ページごとの`/`を除いたルート相対パスを取得します。
|
166
|
+
|
167
|
+
.pipe(data(function(file) {
|
168
|
+
|
169
|
+
locals.relativePath = path.relative(file.base, file.path.replace(/.pug$/, '.html'));
|
170
|
+
|
171
|
+
return locals;
|
172
|
+
|
37
|
-
|
173
|
+
}))
|
174
|
+
|
175
|
+
.pipe(pug({
|
176
|
+
|
177
|
+
// JSONファイルとルート相対パスの情報を渡します。
|
178
|
+
|
179
|
+
locals: locals,
|
180
|
+
|
181
|
+
// Pugファイルのルートディレクトリを指定します。
|
182
|
+
|
183
|
+
// `/_includes/_layout`のようにルート相対パスで指定することができます。
|
184
|
+
|
185
|
+
basedir: 'src',
|
186
|
+
|
187
|
+
// Pugファイルの整形。
|
188
|
+
|
189
|
+
pretty: true
|
190
|
+
|
191
|
+
}))
|
192
|
+
|
193
|
+
.pipe(gulp.dest(dest.html))
|
194
|
+
|
195
|
+
.pipe(browserSync.reload({stream: true}));
|
196
|
+
|
197
|
+
}
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
/**
|
202
|
+
|
203
|
+
* cssファイルをdestディレクトリに出力(コピー)します。
|
204
|
+
|
205
|
+
*/
|
206
|
+
|
207
|
+
function css() {
|
208
|
+
|
209
|
+
return gulp.src(src.css, {base: src.root})
|
210
|
+
|
211
|
+
.pipe(gulp.dest(dest.root))
|
212
|
+
|
213
|
+
.pipe(browserSync.reload({stream: true}));
|
214
|
+
|
215
|
+
}
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
/**
|
222
|
+
|
223
|
+
* sassファイルをdestディレクトリに同じ階層として出力(コピー)します。
|
224
|
+
|
225
|
+
*/
|
38
226
|
|
39
227
|
function sass() {
|
40
228
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
at
|
60
|
-
|
61
|
-
at
|
62
|
-
|
63
|
-
a
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
n
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
n
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
npm ERR! A complete log of this run can be found in:
|
84
|
-
|
85
|
-
npm ERR! C:\Users\ユーザー名\AppData\Roaming\npm-cache\_logs\2019-04-22T02_35_47_045Z-debug.log
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
【log】
|
90
|
-
|
91
|
-
0 info it worked if it ends with ok
|
92
|
-
|
93
|
-
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
|
94
|
-
|
95
|
-
1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
|
96
|
-
|
97
|
-
1 verbose cli 'start' ]
|
98
|
-
|
99
|
-
2 info using npm@6.4.1
|
100
|
-
|
101
|
-
3 info using node@v10.15.3
|
102
|
-
|
103
|
-
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
|
104
|
-
|
105
|
-
5 info lifecycle gulp-pug-test@1.0.0~prestart: gulp-pug-test@1.0.0
|
106
|
-
|
107
|
-
6 info lifecycle gulp-pug-test@1.0.0~start: gulp-pug-test@1.0.0
|
108
|
-
|
109
|
-
7 verbose lifecycle gulp-pug-test@1.0.0~start: unsafe-perm in lifecycle true
|
110
|
-
|
111
|
-
8 verbose lifecycle gulp-pug-test@1.0.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\ユーザー名\Documents\ディレクトリ名\ディレクトリ名\ディレクトリ名\ディレクトリ名\pug-sass-test\node_modules.bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\tidy2_x64;C:\xampp\php;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\nodejs\;C:\ProgramData\ComposerSetup\bin;C:\Program Files\Git\cmd;C:\Users\polyphony10\AppData\Local\Microsoft\WindowsApps;C:\Users\polyphony10\AppData\Roaming\npm;C:\Users\polyphony10\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\polyphony10\AppData\Roaming\Composer\vendor\bin
|
112
|
-
|
113
|
-
9 verbose lifecycle gulp-pug-test@1.0.0~start: CWD: C:\Users\ユーザー名\Documents\ディレクトリ名\ディレクトリ名\ディレクトリ名\ディレクトリ名\pug-sass-test
|
114
|
-
|
115
|
-
10 silly lifecycle gulp-pug-test@1.0.0~start: Args: [ '/d /s /c', 'gulp' ]
|
116
|
-
|
117
|
-
11 silly lifecycle gulp-pug-test@1.0.0~start: Returned: code: 1 signal: null
|
118
|
-
|
119
|
-
12 info lifecycle gulp-pug-test@1.0.0~start: Failed to exec start script
|
120
|
-
|
121
|
-
13 verbose stack Error: gulp-pug-test@1.0.0 start: `gulp`
|
122
|
-
|
123
|
-
13 verbose stack Exit status 1
|
124
|
-
|
125
|
-
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
|
126
|
-
|
127
|
-
13 verbose stack at EventEmitter.emit (events.js:189:13)
|
128
|
-
|
129
|
-
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
|
130
|
-
|
131
|
-
13 verbose stack at ChildProcess.emit (events.js:189:13)
|
132
|
-
|
133
|
-
13 verbose stack at maybeClose (internal/child_process.js:970:16)
|
134
|
-
|
135
|
-
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
|
136
|
-
|
137
|
-
14 verbose pkgid gulp-pug-test@1.0.0
|
138
|
-
|
139
|
-
15 verbose cwd C:\Users\ユーザー名\Documents\ディレクトリ名\ディレクトリ名\ディレクトリ名\ディレクトリ名\pug-sass-test
|
140
|
-
|
141
|
-
16 verbose Windows_NT 10.0.17763
|
142
|
-
|
143
|
-
17 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "start"
|
144
|
-
|
145
|
-
18 verbose node v10.15.3
|
146
|
-
|
147
|
-
19 verbose npm v6.4.1
|
148
|
-
|
149
|
-
20 error code ELIFECYCLE
|
150
|
-
|
151
|
-
21 error errno 1
|
152
|
-
|
153
|
-
22 error gulp-pug-test@1.0.0 start: `gulp`
|
154
|
-
|
155
|
-
22 error Exit status 1
|
156
|
-
|
157
|
-
23 error Failed at the gulp-pug-test@1.0.0 start script.
|
158
|
-
|
159
|
-
23 error This is probably not a problem with npm. There is likely additional logging output above.
|
160
|
-
|
161
|
-
24 verbose exit [ 1, true ]
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
```
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
### 該当のソースコード
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
```JavaScript
|
178
|
-
|
179
|
-
const gulp = require('gulp');
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
//pug
|
184
|
-
|
185
|
-
const pug = require('gulp-pug');
|
186
|
-
|
187
|
-
const fs = require('fs');
|
188
|
-
|
189
|
-
const data = require('gulp-data');
|
190
|
-
|
191
|
-
const path = require('path');
|
192
|
-
|
193
|
-
const plumber = require('gulp-plumber');
|
194
|
-
|
195
|
-
const notify = require('gulp-notify');
|
196
|
-
|
197
|
-
const browserSync = require('browser-sync');
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
//css
|
202
|
-
|
203
|
-
const sass = require('gulp-sass');
|
204
|
-
|
205
|
-
const sassGlob = require('gulp-sass-glob');
|
206
|
-
|
207
|
-
const postcss = require('gulp-postcss');
|
208
|
-
|
209
|
-
const flexBugsFixes = require('postcss-flexbugs-fixes');
|
210
|
-
|
211
|
-
const autoprefixer = require('gulp-autoprefixer'); //Sassにベンダープレフィックスをつける
|
212
|
-
|
213
|
-
const rename = require('gulp-rename'); //ファイルをリネーム
|
229
|
+
const plugins = [flexBugsFixes(), autoprefixer()];
|
230
|
+
|
231
|
+
return gulp.src(src.scss, {base: src.root})
|
232
|
+
|
233
|
+
.pipe(sassGlob())
|
234
|
+
|
235
|
+
.pipe(sass({
|
236
|
+
|
237
|
+
outputStyle: 'expanded',
|
238
|
+
|
239
|
+
}).on('error', sass.logError),
|
240
|
+
|
241
|
+
)
|
242
|
+
|
243
|
+
.pipe(plumber({ errorHandler: notify.onError('Error: <%= error.message %>') }))
|
244
|
+
|
245
|
+
.pipe(postcss(plugins))
|
246
|
+
|
247
|
+
.pipe(autoprefixer({ // ベンダープレフィックスの付与
|
248
|
+
|
249
|
+
browsers: ['last 3 version', 'ie >= 10','iOS >= 9.3', 'Android >= 4.4'], // (ベンダープレフィックスを付与する)対応ブラウザの指定
|
250
|
+
|
251
|
+
cascade: true // 整形する
|
252
|
+
|
253
|
+
}))
|
254
|
+
|
255
|
+
.pipe(rename(function (path) {
|
256
|
+
|
257
|
+
path.dirname += '/css';
|
258
|
+
|
259
|
+
}))
|
260
|
+
|
261
|
+
.pipe(gulp.dest('../'))
|
262
|
+
|
263
|
+
.pipe(browserSync.reload({ stream: true }));
|
264
|
+
|
265
|
+
}
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
214
270
|
|
215
271
|
|
216
272
|
|
217
273
|
/**
|
218
274
|
|
219
|
-
*
|
275
|
+
* jsファイルをdestディレクトリに出力(コピー)します。
|
220
276
|
|
221
277
|
*/
|
222
278
|
|
223
|
-
const src = {
|
224
|
-
|
225
|
-
// 出力対象は`_`で始まっていない`.pug`ファイル。
|
226
|
-
|
227
|
-
'html': ['src/**/*.pug', '!' + 'src/**/_*.pug'],
|
228
|
-
|
229
|
-
// JSONファイルのディレクトリを変数化。
|
230
|
-
|
231
|
-
|
279
|
+
gulp.task('js', function() {
|
232
|
-
|
233
|
-
|
280
|
+
|
234
|
-
|
235
|
-
'sass': ['src/**/*.scss', '!' + 'src/**/_*.scss'],
|
236
|
-
|
237
|
-
//'styleguideWatch': 'src/**/*.scss',
|
238
|
-
|
239
|
-
|
281
|
+
return gulp.src(src.js, {base: src.root})
|
282
|
+
|
240
|
-
|
283
|
+
.pipe(gulp.dest(dest.root))
|
284
|
+
|
285
|
+
.pipe(browserSync.reload({stream: true}));
|
286
|
+
|
241
|
-
};
|
287
|
+
});
|
242
288
|
|
243
289
|
|
244
290
|
|
245
291
|
/**
|
246
292
|
|
247
|
-
*
|
293
|
+
* ローカルサーバーを起動します。
|
248
294
|
|
249
295
|
*/
|
250
296
|
|
251
|
-
const dest = {
|
252
|
-
|
253
|
-
|
297
|
+
gulp.task('browser-sync', function() {
|
298
|
+
|
254
|
-
|
299
|
+
browserSync({
|
300
|
+
|
301
|
+
server: {
|
302
|
+
|
303
|
+
baseDir: dest.root,
|
304
|
+
|
255
|
-
|
305
|
+
index: "index.html"
|
306
|
+
|
256
|
-
|
307
|
+
}
|
308
|
+
|
257
|
-
};
|
309
|
+
});
|
310
|
+
|
311
|
+
});
|
258
312
|
|
259
313
|
|
260
314
|
|
261
315
|
/**
|
262
316
|
|
263
|
-
*
|
317
|
+
* PugのコンパイルやCSSとjsの出力、browser-syncのリアルタイムプレビューを実行します。
|
264
318
|
|
265
319
|
*/
|
266
320
|
|
321
|
+
gulp.task('watch', ['html', 'sass', 'css', 'js', 'browser-sync'], function() {
|
322
|
+
|
267
|
-
|
323
|
+
gulp.watch(src.html, gulp.task('html'));
|
324
|
+
|
268
|
-
|
325
|
+
gulp.watch(src.scss, gulp.task('sass'));
|
326
|
+
|
269
|
-
|
327
|
+
gulp.watch(src.css, gulp.task('css'));
|
270
|
-
|
271
|
-
|
328
|
+
|
272
|
-
|
273
|
-
.
|
329
|
+
gulp.watch(src.js, gulp.task('js'));
|
330
|
+
|
274
|
-
|
331
|
+
//gulp.watch(src.styleguideWatch, ['styleguide']);
|
332
|
+
|
275
|
-
}
|
333
|
+
});
|
276
334
|
|
277
335
|
|
278
336
|
|
279
337
|
/**
|
280
338
|
|
339
|
+
* 開発に使うタスクです。
|
340
|
+
|
281
|
-
*
|
341
|
+
* package.jsonに設定をして、`npm run default`で実行できるようにしています。
|
282
342
|
|
283
343
|
*/
|
284
344
|
|
285
|
-
function sass() {
|
286
|
-
|
287
|
-
const plugins = [flexBugsFixes(), autoprefixer()];
|
288
|
-
|
289
|
-
return gulp.src(src.scss, {base: src.root})
|
290
|
-
|
291
|
-
.pipe(sassGlob())
|
292
|
-
|
293
|
-
.pipe(sass({
|
294
|
-
|
295
|
-
outputStyle: 'expanded',
|
296
|
-
|
297
|
-
}).on('error', sass.logError),
|
298
|
-
|
299
|
-
)
|
300
|
-
|
301
|
-
.pipe(plumber({ errorHandler: notify.onError('Error: <%= error.message %>') }))
|
302
|
-
|
303
|
-
.pipe(postcss(plugins))
|
304
|
-
|
305
|
-
.pipe(autoprefixer({ // ベンダープレフィックスの付与
|
306
|
-
|
307
|
-
browsers: ['last 3 version', 'ie >= 10','iOS >= 9.3', 'Android >= 4.4'], // (ベンダープレフィックスを付与する)対応ブラウザの指定
|
308
|
-
|
309
|
-
cascade: true // 整形する
|
310
|
-
|
311
|
-
}))
|
312
|
-
|
313
|
-
.pipe(rename(function (path) {
|
314
|
-
|
315
|
-
path.dirname += '/css';
|
316
|
-
|
317
|
-
}))
|
318
|
-
|
319
|
-
.pipe(gulp.dest('../'))
|
320
|
-
|
321
|
-
.pipe(browserSync.reload({ stream: true }));
|
322
|
-
|
323
|
-
}
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
/**
|
328
|
-
|
329
|
-
* PugのコンパイルやCSSとjsの出力、browser-syncのリアルタイムプレビューを実行します。
|
330
|
-
|
331
|
-
*/
|
332
|
-
|
333
|
-
gulp.task('watch', ['html', 'sass', 'css', 'js', 'browser-sync'], function() {
|
334
|
-
|
335
|
-
gulp.watch(src.html, gulp.task('html'));
|
336
|
-
|
337
|
-
gulp.watch(src.scss, gulp.task('sass'));
|
338
|
-
|
339
|
-
gulp.watch(src.css, gulp.task('css'));
|
340
|
-
|
341
|
-
gulp.watch(src.js, gulp.task('js'));
|
342
|
-
|
343
|
-
//gulp.watch(src.styleguideWatch, ['styleguide']);
|
344
|
-
|
345
|
-
});
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
/**
|
350
|
-
|
351
|
-
* 開発に使うタスクです。
|
352
|
-
|
353
|
-
* package.jsonに設定をして、`npm run default`で実行できるようにしています。
|
354
|
-
|
355
|
-
*/
|
356
|
-
|
357
345
|
gulp.task('default', ['watch']);
|
358
346
|
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
```
|
352
|
+
|
353
|
+
### index.pug
|
354
|
+
|
355
|
+
```pug
|
356
|
+
|
357
|
+
extend /_includes/_layout
|
358
|
+
|
359
|
+
append variables
|
360
|
+
|
361
|
+
//- Required
|
362
|
+
|
363
|
+
- var pageTitle= "";
|
364
|
+
|
365
|
+
- var pageDescription= site.description;
|
366
|
+
|
367
|
+
- var pageKeywords= site.keywords;
|
368
|
+
|
369
|
+
//- Optional
|
370
|
+
|
371
|
+
- var pageOgpTitle= "";
|
372
|
+
|
373
|
+
- var pageOgpImage= site.ogpImage
|
374
|
+
|
375
|
+
- var pageLang= "ja";
|
376
|
+
|
377
|
+
- var pageOgpType= "website";
|
378
|
+
|
379
|
+
//- Not modified
|
380
|
+
|
381
|
+
- var pageUrl= relativePath;
|
382
|
+
|
383
|
+
|
384
|
+
|
385
|
+
//- 固定ページにのみ追加のCSS
|
386
|
+
|
387
|
+
append css
|
388
|
+
|
389
|
+
link(rel="stylesheet" href="/about/css/about.css")
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
//- 固定ページにのみ追加のJS
|
394
|
+
|
395
|
+
append js
|
396
|
+
|
397
|
+
script(src="/assets/js/common2.js")
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
block content
|
402
|
+
|
403
|
+
// contents
|
404
|
+
|
405
|
+
p Contents変更しますよ
|
406
|
+
|
407
|
+
// /contents
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
```
|
412
|
+
|
413
|
+
|
414
|
+
|
415
|
+
### _footer.pug
|
416
|
+
|
417
|
+
```pug
|
418
|
+
|
419
|
+
// footer
|
420
|
+
|
421
|
+
footer
|
422
|
+
|
423
|
+
p: small copyright m-field
|
424
|
+
|
425
|
+
// /footer
|
426
|
+
|
427
|
+
|
428
|
+
|
429
|
+
```
|
430
|
+
|
431
|
+
|
432
|
+
|
433
|
+
### _header.pug
|
434
|
+
|
435
|
+
```pug
|
436
|
+
|
437
|
+
// header
|
438
|
+
|
439
|
+
header
|
440
|
+
|
441
|
+
h1.site-name Pugで作ったサイト
|
442
|
+
|
443
|
+
|
444
|
+
|
445
|
+
nav.global-nav
|
446
|
+
|
447
|
+
ul
|
448
|
+
|
449
|
+
li: a(href="#") トップ
|
450
|
+
|
451
|
+
li: a(href="#") メニュー01
|
452
|
+
|
453
|
+
li: a(href="#") メニュー02
|
454
|
+
|
455
|
+
li: a(href="#") メニュー03
|
456
|
+
|
457
|
+
li: a(href="#") メニュー04
|
458
|
+
|
459
|
+
// /header
|
460
|
+
|
461
|
+
|
462
|
+
|
463
|
+
```
|
464
|
+
|
465
|
+
### _layout.pug
|
466
|
+
|
467
|
+
```pug
|
468
|
+
|
469
|
+
block variables
|
470
|
+
|
471
|
+
doctype html
|
472
|
+
|
473
|
+
html(lang=pageLang)
|
474
|
+
|
475
|
+
head(prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# " + pageOgpType + ": http://ogp.me/ns/" + pageOgpType + "#")
|
476
|
+
|
477
|
+
include /_includes/_meta
|
478
|
+
|
479
|
+
|
480
|
+
|
481
|
+
body
|
482
|
+
|
483
|
+
include /_includes/_header
|
484
|
+
|
485
|
+
|
486
|
+
|
487
|
+
block content
|
488
|
+
|
489
|
+
|
490
|
+
|
491
|
+
include /_includes/_footer
|
492
|
+
|
493
|
+
include /_includes/_script
|
494
|
+
|
495
|
+
|
496
|
+
|
497
|
+
```
|
498
|
+
|
499
|
+
### _meta.pug
|
500
|
+
|
501
|
+
```pug
|
502
|
+
|
503
|
+
meta(charset="UTF-8")
|
504
|
+
|
505
|
+
meta(http-equiv="X-UA-Compatible" content="IE=edge")
|
506
|
+
|
507
|
+
meta(name="viewport" content="width=device-width, initial-scale=1.0")
|
508
|
+
|
509
|
+
meta(name="format-detection" content="telephone=no")
|
510
|
+
|
511
|
+
if pageTitle
|
512
|
+
|
513
|
+
title #{pageTitle} | #{site.name}
|
514
|
+
|
515
|
+
else
|
516
|
+
|
517
|
+
title #{site.name}
|
518
|
+
|
519
|
+
meta(name="description" content=pageDescription)
|
520
|
+
|
521
|
+
meta(name="keywords" content=pageKeywords)
|
522
|
+
|
523
|
+
|
524
|
+
|
525
|
+
block css
|
526
|
+
|
527
|
+
link(rel="stylesheet" href="/assets/css/base/reset.css")
|
528
|
+
|
529
|
+
link(rel="stylesheet" href="/assets/css/base/common.css")
|
530
|
+
|
531
|
+
|
532
|
+
|
533
|
+
//- OGP
|
534
|
+
|
535
|
+
if pageOgpTitle
|
536
|
+
|
537
|
+
meta(property="og:title" content=pageOgpTitle + ' | ' + site.name)
|
538
|
+
|
539
|
+
else
|
540
|
+
|
541
|
+
meta(property="og:title" content=site.name)
|
542
|
+
|
543
|
+
meta(property="og:type" content=pageOgpType)
|
544
|
+
|
545
|
+
meta(property="og:image" content=pageOgpImage)
|
546
|
+
|
547
|
+
meta(property="og:url" content=site.rootUrl + pageUrl)
|
548
|
+
|
549
|
+
meta(property="og:description" content=pageDescription)
|
550
|
+
|
551
|
+
meta(property="og:site_name" content=site.name)
|
552
|
+
|
553
|
+
meta(property="og:locale" content=pageLang)
|
554
|
+
|
555
|
+
|
556
|
+
|
557
|
+
//- OGP Facebook insights
|
558
|
+
|
559
|
+
meta(property="fb:admins" content="")
|
560
|
+
|
561
|
+
meta(property="fb:app_id" content="")
|
562
|
+
|
563
|
+
//- /OGP Facebook insights
|
564
|
+
|
565
|
+
|
566
|
+
|
567
|
+
//- OGP Twitter Cards
|
568
|
+
|
569
|
+
meta(name="twitter:card" content="summary")
|
570
|
+
|
571
|
+
meta(name="twitter:site" content="@")
|
572
|
+
|
573
|
+
//- /OGP Twitter Cards
|
574
|
+
|
575
|
+
|
576
|
+
|
577
|
+
//- /OGP
|
578
|
+
|
579
|
+
|
580
|
+
|
581
|
+
```
|
582
|
+
|
583
|
+
### _scriput.pug
|
584
|
+
|
585
|
+
```pug
|
586
|
+
|
587
|
+
block js
|
588
|
+
|
589
|
+
script(src="/assets/js/common.js")
|
590
|
+
|
591
|
+
|
592
|
+
|
593
|
+
```
|
594
|
+
|
595
|
+
|
596
|
+
|
597
|
+
### base.scss
|
598
|
+
|
599
|
+
```scss
|
600
|
+
|
601
|
+
$pc: 1024px; // PC
|
602
|
+
|
603
|
+
$tab: 680px; // タブレット
|
604
|
+
|
605
|
+
$sp: 480px; // スマホ
|
606
|
+
|
607
|
+
|
608
|
+
|
609
|
+
@mixin pc {
|
610
|
+
|
611
|
+
@media (max-width: ($pc)) {
|
612
|
+
|
613
|
+
@content;
|
614
|
+
|
615
|
+
}
|
616
|
+
|
617
|
+
}
|
618
|
+
|
619
|
+
@mixin tab {
|
620
|
+
|
621
|
+
@media (max-width: ($tab)) {
|
622
|
+
|
623
|
+
@content;
|
624
|
+
|
625
|
+
}
|
626
|
+
|
627
|
+
}
|
628
|
+
|
629
|
+
@mixin sp {
|
630
|
+
|
631
|
+
@media (max-width: ($sp)) {
|
632
|
+
|
633
|
+
@content;
|
634
|
+
|
635
|
+
}
|
636
|
+
|
637
|
+
}
|
638
|
+
|
639
|
+
|
640
|
+
|
641
|
+
.box {
|
642
|
+
|
643
|
+
@include pc {
|
644
|
+
|
645
|
+
background-color: red;
|
646
|
+
|
647
|
+
};
|
648
|
+
|
649
|
+
@include tab {
|
650
|
+
|
651
|
+
background-color: blue;
|
652
|
+
|
653
|
+
};
|
654
|
+
|
655
|
+
@include sp {
|
656
|
+
|
657
|
+
background-color: yellow;
|
658
|
+
|
659
|
+
};
|
660
|
+
|
661
|
+
}
|
662
|
+
|
663
|
+
|
664
|
+
|
665
|
+
@import "a";
|
666
|
+
|
667
|
+
@import "b";
|
668
|
+
|
669
|
+
|
670
|
+
|
671
|
+
```
|
672
|
+
|
673
|
+
|
674
|
+
|
675
|
+
### _a.scss
|
676
|
+
|
677
|
+
```_a.scss
|
678
|
+
|
679
|
+
.classA {
|
680
|
+
|
681
|
+
background-color: red;
|
682
|
+
|
683
|
+
}
|
684
|
+
|
685
|
+
|
686
|
+
|
687
|
+
```
|
688
|
+
|
689
|
+
|
690
|
+
|
691
|
+
### _b.scss
|
692
|
+
|
693
|
+
```_b.scss
|
694
|
+
|
695
|
+
.classB {
|
696
|
+
|
697
|
+
background-color: blue;
|
698
|
+
|
699
|
+
}
|
700
|
+
|
701
|
+
|
702
|
+
|
703
|
+
```
|
704
|
+
|
705
|
+
|
706
|
+
|
707
|
+
### common.js
|
708
|
+
|
709
|
+
```js
|
710
|
+
|
711
|
+
(function() {
|
712
|
+
|
713
|
+
console.log('Hello!!');
|
714
|
+
|
715
|
+
}());
|
716
|
+
|
717
|
+
|
718
|
+
|
719
|
+
```
|
720
|
+
|
721
|
+
|
722
|
+
|
723
|
+
### package.json
|
724
|
+
|
725
|
+
```json
|
726
|
+
|
727
|
+
{
|
728
|
+
|
729
|
+
"name": "gulp-pug-test",
|
730
|
+
|
731
|
+
"version": "1.0.0",
|
732
|
+
|
733
|
+
"description": "GulpでPugを実行するためのテスト環境です。",
|
734
|
+
|
735
|
+
"main": "index.js",
|
736
|
+
|
737
|
+
"scripts": {
|
738
|
+
|
739
|
+
"start": "gulp"
|
740
|
+
|
741
|
+
},
|
742
|
+
|
743
|
+
"keywords": [
|
744
|
+
|
745
|
+
"gulp",
|
746
|
+
|
747
|
+
"pug"
|
748
|
+
|
749
|
+
],
|
750
|
+
|
751
|
+
"author": "テンプレ作成者名",
|
752
|
+
|
753
|
+
"license": "MIT",
|
754
|
+
|
755
|
+
"devDependencies": {
|
756
|
+
|
757
|
+
"browser-sync": "^2.26.3",
|
758
|
+
|
759
|
+
"gulp": "^3.9.1",
|
760
|
+
|
761
|
+
"gulp-autoprefixer": "^6.0.0",
|
762
|
+
|
763
|
+
"gulp-clean-css": "^4.0.0",
|
764
|
+
|
765
|
+
"gulp-data": "^1.3.1",
|
766
|
+
|
767
|
+
"gulp-notify": "^2.2.0",
|
768
|
+
|
769
|
+
"gulp-plumber": "^1.2.1",
|
770
|
+
|
771
|
+
"gulp-postcss": "^8.0.0",
|
772
|
+
|
773
|
+
"gulp-pug": "^3.3.0",
|
774
|
+
|
775
|
+
"gulp-rename": "^1.4.0",
|
776
|
+
|
777
|
+
"gulp-sass": "^4.0.2",
|
778
|
+
|
779
|
+
"gulp-sass-glob": "^1.0.9",
|
780
|
+
|
781
|
+
"postcss-flexbugs-fixes": "^4.1.0"
|
782
|
+
|
783
|
+
}
|
784
|
+
|
785
|
+
}
|
786
|
+
|
787
|
+
|
788
|
+
|
789
|
+
|
790
|
+
|
359
791
|
```
|
360
792
|
|
361
793
|
|