-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
75 lines (67 loc) · 1.43 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/**
* Required functionality
*
* @since 1.0.0
*/
var gulp = require( 'gulp' ),
sass = require( 'gulp-sass' ),
notify = require( 'gulp-notify' ),
fileInclude = require( 'gulp-file-include' ),
del = require( 'del' );
/**
* Assets directory
*
* @since 1.0.0
* @type {String}
*/
var assets = './test/assets';
/**
* Clean build directory
*
* @since 1.0.0
*/
gulp.task( 'clean', function() {
return del( ['build'] );
});
/**
* Compile Sass
*
* @since 1.0.0
*/
gulp.task( 'compileSass', ['clean'], function() {
return gulp.src( assets + '/sass/**/*.scss' )
.pipe( sass().on( 'error', sass.logError ) )
.pipe( gulp.dest( assets + '/css/' ) )
.pipe( notify( 'adapt compiled' ) );
});
/**
* Build HTML file and output to root directory
*
* @see gulp-file-include
* @since 1.0.0
*/
gulp.task( 'buildHtml', function() {
return gulp.src( './test/index.html' )
.pipe( fileInclude({
basepath: './test/partials'
}))
.pipe( gulp.dest( './' ) );
})
/**
* Watch files for changes
*
* @since 1.0.0
*/
gulp.task('watch', function(){
gulp.watch( assets + '/sass/**/*.scss', ['compileSass'] );
gulp.watch( './src/**/*.scss', ['compileSass'] );
gulp.watch( './_adapt.scss', ['compileSass'] );
gulp.watch( './test/**/*.html', ['buildHtml'] );
gulp.watch( './test/partials/**/*.html', ['buildHtml'] );
});
/**
* Define the default task
*
* @since 1.0.0
*/
gulp.task( 'default', ['watch', 'compileSass', 'buildHtml'] );