1
+ import babelPreset from 'babel-preset-es2015' ;
1
2
import gulp from 'gulp' ;
2
- import del from 'del' ;
3
3
import sequence from 'run-sequence' ;
4
- import babelPreset from 'babel-preset-es2015' ;
5
4
6
5
const $ = require ( 'gulp-load-plugins' ) ( ) ;
7
6
8
7
// ================================================================
9
8
// CONSTS
10
9
// ================================================================
11
- const buildDir = 'build' ;
12
-
13
10
const path = {
14
11
src : {
15
12
styles : 'src/sass/styles.scss' ,
@@ -23,24 +20,18 @@ const path = {
23
20
'src/js/main.js' ,
24
21
] ,
25
22
} ,
26
- images : 'src/img/**/*' ,
27
- fonts : 'src/fonts/**/*' ,
28
- html : '*.html' ,
23
+ images : './img/**/*' ,
29
24
} ,
30
25
31
26
build : {
32
- styles : `${ buildDir } /css/` ,
33
- js : `${ buildDir } /js/` ,
34
- images : `${ buildDir } /img/` ,
35
- fonts : `${ buildDir } /fonts/` ,
36
- html : `${ buildDir } ` ,
27
+ styles : './css/' ,
28
+ js : './js/' ,
29
+ images : './img/' ,
37
30
} ,
38
31
39
32
watch : {
40
33
styles : 'src/sass/**/*' ,
41
34
js : 'src/js/**/*' ,
42
- images : 'src/img/**/*' ,
43
- fonts : 'src/fonts/**/*' ,
44
35
html : 'index.html' ,
45
36
} ,
46
37
} ;
@@ -50,22 +41,15 @@ const path = {
50
41
// ================================================================
51
42
gulp . task ( 'build' , ( ) => {
52
43
sequence (
53
- 'clear' , [
54
- 'fonts' ,
44
+ [
55
45
'images' ,
56
- 'html' ,
57
46
'js-vendors' ,
58
47
'js' ,
59
48
'styles' ,
60
49
] ,
61
50
) ;
62
51
} ) ;
63
52
64
- // ================================================================
65
- // Clear : Clear destination dir before build.
66
- // ================================================================
67
- gulp . task ( 'clear' , ( ) => del ( `${ buildDir } /**/*` ) ) ;
68
-
69
53
// ================================================================
70
54
// STYLES : Build common stylesheets
71
55
// ================================================================
@@ -126,31 +110,12 @@ gulp.task('images', () => {
126
110
. pipe ( gulp . dest ( path . build . images ) ) ;
127
111
} ) ;
128
112
129
- // ================================================================
130
- // Fonts
131
- // ================================================================
132
- gulp . task ( 'fonts' , ( ) => {
133
- gulp . src ( path . src . fonts )
134
- . pipe ( $ . changed ( path . build . fonts ) )
135
- . pipe ( gulp . dest ( path . build . fonts ) ) ;
136
- } ) ;
137
-
138
- // ================================================================
139
- // Html
140
- // ================================================================
141
- gulp . task ( 'html' , ( ) => {
142
- gulp . src ( path . src . html )
143
- . pipe ( $ . changed ( path . build . html ) )
144
- . pipe ( gulp . dest ( path . build . html ) )
145
- . pipe ( $ . livereload ( ) ) ;
146
- } ) ;
147
-
148
113
// ================================================================
149
114
// Server simulation
150
115
// ================================================================
151
116
gulp . task ( 'connect' , ( ) => {
152
117
$ . connect . server ( {
153
- root : 'build ' ,
118
+ root : '. ' ,
154
119
livereload : true ,
155
120
} ) ;
156
121
} ) ;
@@ -162,7 +127,7 @@ gulp.task('watch', () => {
162
127
$ . livereload . listen ( ) ;
163
128
gulp . watch ( path . watch . js , [ 'js' ] ) ;
164
129
gulp . watch ( path . watch . styles , [ 'styles' ] ) ;
165
- gulp . watch ( path . watch . html , [ 'html' ] ) ;
130
+ gulp . watch ( path . watch . html , $ . livereload ( ) ) ;
166
131
} ) ;
167
132
168
133
// ================================================================
0 commit comments