-
Notifications
You must be signed in to change notification settings - Fork 8
/
gulpfile.js
40 lines (34 loc) · 1.07 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
'use strict';
const gulp = require( 'gulp' );
const sass = require( 'gulp-sass' );
const sourcemaps = require( 'gulp-sourcemaps' );
// Compilable directories
const dirs = [
'core',
'ui',
];
// Prepares the GULP task for a stylesheet
function prepareStylesheet( path ) {
return gulp.src( './' + path + '/assets/sass/*.scss' )
.pipe( sourcemaps.init() )
.pipe( sass().on( 'error', sass.logError ) )
.pipe( sourcemaps.write( '.' ) )
.pipe( gulp.dest( './' + path + '/assets/css' ) );
}
// Create a task for every stylesheet
dirs.forEach(function( path ) {
gulp.task( path, () => prepareStylesheet( path ) );
});
// Create a default task, which depends on the rest
gulp.task( 'default', dirs, function () {
// Nothing to do here, everything is in the dependency
// Available as "npm run build"
});
// Monitors
gulp.task( 'watch', function () {
// Available as "npm run watch"
dirs.forEach( path => {
gulp.watch( './' + path + '/assets/sass/*.scss', [ path ] );
gulp.watch( './' + path + '/assets/sass/**/*.scss', [ path ] );
});
});