質問編集履歴
6
gulpfil部分削除 (解答欄追記のため)
title
CHANGED
File without changes
|
body
CHANGED
@@ -25,30 +25,6 @@
|
|
25
25
|
<%- include(ejsRoot + 'common/header', {current : 'news'}); %>
|
26
26
|
```
|
27
27
|
|
28
|
-
|
29
|
-
**gulpfile.js**
|
30
|
-
```
|
31
|
-
var paths = {
|
32
|
-
root: './src',ejsDir: {
|
33
|
-
src: './src/html/**/*.html',
|
34
|
-
ejs: './src/**/*.ejs',
|
35
|
-
dest: './dist/',
|
36
|
-
filtering: '!./src/**/_*.ejs'
|
37
|
-
}
|
38
|
-
};
|
39
|
-
gulp.task('ejs_dev', function() {
|
40
|
-
gulp.src([paths.ejsDir.src, paths.ejsDir.filtering])
|
41
|
-
// .pipe(changed(ejsDir.dest))
|
42
|
-
.pipe(plumber())
|
43
|
-
.pipe(ejs({},{"ext": ".html"}))
|
44
|
-
.pipe(prettify({indent_char: ' ', indent_size: 2}))
|
45
|
-
.pipe(gulp.dest(paths.ejsDir.dest))
|
46
|
-
.pipe(browserSync.reload({
|
47
|
-
stream: true
|
48
|
-
}));
|
49
|
-
});
|
50
|
-
|
51
|
-
```
|
52
28
|
---
|
53
29
|
|
54
30
|
ejsが反映されるパターン(if文なし)
|
@@ -62,28 +38,4 @@
|
|
62
38
|
```
|
63
39
|
<% var ejsRoot = '../../'; %>
|
64
40
|
<%- include(ejsRoot + 'common/header', {current : '〇〇'}); %>
|
65
|
-
```
|
66
|
-
|
67
|
-
|
68
|
-
**gulpfile.js(browserSync.reloadをコメントアウト)**
|
69
|
-
```
|
70
|
-
var paths = {
|
71
|
-
root: './src',ejsDir: {
|
72
|
-
src: './src/html/**/*.html',
|
73
|
-
ejs: './src/**/*.ejs',
|
74
|
-
dest: './dist/',
|
75
|
-
filtering: '!./src/**/_*.ejs'
|
76
|
-
}
|
77
|
-
};
|
78
|
-
gulp.task('ejs_dev', function() {
|
79
|
-
gulp.src([paths.ejsDir.src, paths.ejsDir.filtering])
|
80
|
-
// .pipe(changed(ejsDir.dest))
|
81
|
-
.pipe(plumber())
|
82
|
-
.pipe(ejs({},{"ext": ".html"}))
|
83
|
-
.pipe(prettify({indent_char: ' ', indent_size: 2}))
|
84
|
-
.pipe(gulp.dest(paths.ejsDir.dest))
|
85
|
-
// .pipe(browserSync.reload({
|
86
|
-
// stream: true
|
87
|
-
// }));
|
88
|
-
});
|
89
41
|
```
|
5
解答欄に移動
title
CHANGED
File without changes
|
body
CHANGED
@@ -8,18 +8,8 @@
|
|
8
8
|
と書き出されてしまいます。
|
9
9
|
ejsが反映され、且つ<li class="nav active">になってるようにするにはどうすればいいでしょうか?
|
10
10
|
|
11
|
-
---
|
12
|
-
追記
|
13
|
-
gulpfile.jsの以下文をコメントアウトしたら反映されました。
|
14
|
-
```
|
15
|
-
.pipe(browserSync.reload({
|
16
|
-
stream: true
|
17
|
-
}))
|
18
|
-
```
|
19
|
-
browserSyncを効かせた状態にしたいのですが、どうすればよいでしょうか?
|
20
11
|
|
21
12
|
|
22
|
-
|
23
13
|
---
|
24
14
|
|
25
15
|
ejsが反映されないパターン
|
4
gulpfileコード部分修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -37,6 +37,7 @@
|
|
37
37
|
|
38
38
|
|
39
39
|
**gulpfile.js**
|
40
|
+
```
|
40
41
|
var paths = {
|
41
42
|
root: './src',ejsDir: {
|
42
43
|
src: './src/html/**/*.html',
|
@@ -57,6 +58,7 @@
|
|
57
58
|
}));
|
58
59
|
});
|
59
60
|
|
61
|
+
```
|
60
62
|
---
|
61
63
|
|
62
64
|
ejsが反映されるパターン(if文なし)
|
@@ -74,6 +76,7 @@
|
|
74
76
|
|
75
77
|
|
76
78
|
**gulpfile.js(browserSync.reloadをコメントアウト)**
|
79
|
+
```
|
77
80
|
var paths = {
|
78
81
|
root: './src',ejsDir: {
|
79
82
|
src: './src/html/**/*.html',
|
@@ -92,4 +95,5 @@
|
|
92
95
|
// .pipe(browserSync.reload({
|
93
96
|
// stream: true
|
94
97
|
// }));
|
95
|
-
});
|
98
|
+
});
|
99
|
+
```
|
3
gulpfil.js追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -9,7 +9,19 @@
|
|
9
9
|
ejsが反映され、且つ<li class="nav active">になってるようにするにはどうすればいいでしょうか?
|
10
10
|
|
11
11
|
---
|
12
|
+
追記
|
13
|
+
gulpfile.jsの以下文をコメントアウトしたら反映されました。
|
14
|
+
```
|
15
|
+
.pipe(browserSync.reload({
|
16
|
+
stream: true
|
17
|
+
}))
|
18
|
+
```
|
19
|
+
browserSyncを効かせた状態にしたいのですが、どうすればよいでしょうか?
|
12
20
|
|
21
|
+
|
22
|
+
|
23
|
+
---
|
24
|
+
|
13
25
|
ejsが反映されないパターン
|
14
26
|
|
15
27
|
**header.ejs**
|
@@ -23,6 +35,28 @@
|
|
23
35
|
<%- include(ejsRoot + 'common/header', {current : 'news'}); %>
|
24
36
|
```
|
25
37
|
|
38
|
+
|
39
|
+
**gulpfile.js**
|
40
|
+
var paths = {
|
41
|
+
root: './src',ejsDir: {
|
42
|
+
src: './src/html/**/*.html',
|
43
|
+
ejs: './src/**/*.ejs',
|
44
|
+
dest: './dist/',
|
45
|
+
filtering: '!./src/**/_*.ejs'
|
46
|
+
}
|
47
|
+
};
|
48
|
+
gulp.task('ejs_dev', function() {
|
49
|
+
gulp.src([paths.ejsDir.src, paths.ejsDir.filtering])
|
50
|
+
// .pipe(changed(ejsDir.dest))
|
51
|
+
.pipe(plumber())
|
52
|
+
.pipe(ejs({},{"ext": ".html"}))
|
53
|
+
.pipe(prettify({indent_char: ' ', indent_size: 2}))
|
54
|
+
.pipe(gulp.dest(paths.ejsDir.dest))
|
55
|
+
.pipe(browserSync.reload({
|
56
|
+
stream: true
|
57
|
+
}));
|
58
|
+
});
|
59
|
+
|
26
60
|
---
|
27
61
|
|
28
62
|
ejsが反映されるパターン(if文なし)
|
@@ -36,4 +70,26 @@
|
|
36
70
|
```
|
37
71
|
<% var ejsRoot = '../../'; %>
|
38
72
|
<%- include(ejsRoot + 'common/header', {current : '〇〇'}); %>
|
39
|
-
```
|
73
|
+
```
|
74
|
+
|
75
|
+
|
76
|
+
**gulpfile.js(browserSync.reloadをコメントアウト)**
|
77
|
+
var paths = {
|
78
|
+
root: './src',ejsDir: {
|
79
|
+
src: './src/html/**/*.html',
|
80
|
+
ejs: './src/**/*.ejs',
|
81
|
+
dest: './dist/',
|
82
|
+
filtering: '!./src/**/_*.ejs'
|
83
|
+
}
|
84
|
+
};
|
85
|
+
gulp.task('ejs_dev', function() {
|
86
|
+
gulp.src([paths.ejsDir.src, paths.ejsDir.filtering])
|
87
|
+
// .pipe(changed(ejsDir.dest))
|
88
|
+
.pipe(plumber())
|
89
|
+
.pipe(ejs({},{"ext": ".html"}))
|
90
|
+
.pipe(prettify({indent_char: ' ', indent_size: 2}))
|
91
|
+
.pipe(gulp.dest(paths.ejsDir.dest))
|
92
|
+
// .pipe(browserSync.reload({
|
93
|
+
// stream: true
|
94
|
+
// }));
|
95
|
+
});
|
2
ejs名修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
グローバルナビをjs無しでclass付けしてカレント(アクティブ)かどうかの制御がしたいのですが、効かなくて数日悩んでます。
|
2
2
|
|
3
3
|
例えば、 news.html内のincludeの「current」が'news'だった場合、
|
4
|
-
header.ejsの<li>の中にclass="
|
4
|
+
header.ejsの<li>の中にclass="active"をあてたいのですが、書き方が悪いのかそのまま
|
5
5
|
> <% var ejsRoot = '../../'; %>
|
6
|
-
> <%- include(ejsRoot + 'common/
|
6
|
+
> <%- include(ejsRoot + 'common/header', {current : 'news'}); %>
|
7
7
|
|
8
8
|
と書き出されてしまいます。
|
9
9
|
ejsが反映され、且つ<li class="nav active">になってるようにするにはどうすればいいでしょうか?
|
@@ -20,7 +20,7 @@
|
|
20
20
|
**news.html**
|
21
21
|
```
|
22
22
|
<% var ejsRoot = '../../'; %>
|
23
|
-
<%- include(ejsRoot + 'common/
|
23
|
+
<%- include(ejsRoot + 'common/header', {current : 'news'}); %>
|
24
24
|
```
|
25
25
|
|
26
26
|
---
|
@@ -35,5 +35,5 @@
|
|
35
35
|
**〇〇.html**
|
36
36
|
```
|
37
37
|
<% var ejsRoot = '../../'; %>
|
38
|
-
<%- include(ejsRoot + 'common/
|
38
|
+
<%- include(ejsRoot + 'common/header', {current : '〇〇'}); %>
|
39
39
|
```
|
1
タグ追加
title
CHANGED
File without changes
|
body
CHANGED
File without changes
|