forked from foundation/foundation-sites-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
49 lines (41 loc) · 1.23 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
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var $ = require('gulp-load-plugins')();
var autoprefixer = require('autoprefixer');
var gsass = require('gulp-sass')(require('node-sass'));
var sassPaths = [
'node_modules/foundation-sites/scss',
'node_modules/motion-ui/src'
];
function sass( path ) {
return gulp.src( path )
//.pipe(sourcemaps.init())
.pipe(gsass({
includePaths: sassPaths,
outputStyle: 'compressed' // if css compressed **file size**
})
.on('error', gsass.logError))
.pipe($.postcss([
autoprefixer()
]))
.pipe(gulp.dest('css'))
.pipe(browserSync.stream());
};
function sassFrontend(){
return sass('scss/app.scss');
}
function sassBackend(){
return sass('scss/app-backend.scss');
}
function serve() {
browserSync.init({
server: "./"
});
gulp.watch("scss/*.scss", sassFrontend);
gulp.watch("scss/*.scss", sassBackend);
gulp.watch("*.html").on('change', browserSync.reload);
}
gulp.task('sassFrontend', sassFrontend);
gulp.task('sassBackend', sassBackend);
gulp.task('serve', gulp.series('sassFrontend', 'sassBackend', serve));
gulp.task('default', gulp.series('sassFrontend', 'sassBackend', serve));