-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.js
59 lines (48 loc) · 1.7 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
var gulp = require('gulp');
//include plugins
var changed = require('gulp-changed'),
scss = require('gulp-sass'),
plumber = require('gulp-plumber'),
autoprefixer = require('gulp-autoprefixer'),
concat = require('gulp-concat'),
browserSync = require('browser-sync').create(),
reload = browserSync.reload;
// set paths
// var SRC = 'static';
var SRC_FILES = 'static/**/*';
var SRC_SCSS = 'static/sass/style/*.scss';
var SRC_ALL_SCSS = 'static/sass/**/*.scss';
var VIEWS = 'templates/**/*';
// distribution
var SRC_DIST_CSS = 'static/css';
// var SRC_DIST_JS = 'static/dist/js';
// var SRC_DIST = 'static/dist/';
gulp.task('serve', ['watch'], function(){
browserSync.init(null, {
proxy: "http://localhost:8000/en/person/1/",
files: [SRC_FILES],
browser: ["google chrome canary"],
port: 7000
});
gulp.watch(SRC_ALL_SCSS, ['scss']);
gulp.watch('/templates/*').on('change', reload);
gulp.watch(VIEWS).on('change', reload);
gulp.watch(SRC_DIST_CSS).on('change', reload); //when there is a change to the css file, reload the page
});
// CASCADE STYLE SHEETS
gulp.task('scss', function(){
gulp.src(SRC_SCSS) // set the destination of the scss source file
.pipe(plumber())
.pipe(scss())
.pipe(autoprefixer('last 2 versions')) // set the css autoprefix to scss, like bourbon
.pipe(gulp.dest(SRC_DIST_CSS));
console.log(SRC_DIST_CSS+': done');
//set the destination of the newly generatede css file
});
gulp.task('watch', function(){ // watch come in the gulp utility, no need to npm install
// gulp.watch(SRC_ALL_SCSS, ['scss']);
gulp.watch(SRC_ALL_SCSS, ['scss']);
});
//run the gulp tasks
gulp.task('default', ['serve', 'watch']);
// gulp.task('default', ['watch']);