-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
68 lines (63 loc) · 1.78 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
var gulp = require('gulp'),
nodemon = require('gulp-nodemon'),
plumber = require('gulp-plumber'),
livereload = require('gulp-livereload'),
concat = require('gulp-concat'),
postcss = require('gulp-postcss'),
cssnano = require('cssnano'),
reporter = require('postcss-reporter'),
cssnext = require('postcss-cssnext'),
uglify = require('gulp-uglify');
gulp.task('styles', function () {
var processors = [
cssnext({browsers: ['last 10 versions']}),
cssnano({
discardComments: {
removeAll: true
}
}),
reporter()
];
return gulp.src(['./assets/css/*.css', './assets/plugins/custom-google-map/ggl-map-main.css'])
.pipe(concat('styles.css'))
.pipe(postcss(processors))
.pipe(gulp.dest('./assets/public/css'))
.pipe(livereload());
});
gulp.task('scripts', function() {
return gulp.src([
'./node_modules/es6-promise/dist/es6-promise.js',
'./node_modules/whatwg-fetch/fetch.js',
'./assets/js/main.js'
])
.pipe(concat('main.min.js'))
.pipe(uglify())
.pipe(gulp.dest('./assets/public/js'))
.pipe(livereload());
});
gulp.task('watch', function() {
gulp.watch(['./assets/css/*.css', './assets/js/*.js'], ['styles', 'scripts']);
});
gulp.task('develop', function () {
livereload.listen();
nodemon({
script: 'bin/www',
ext: 'js handlebars coffee',
stdout: false,
ignore: ['assets/css/*', 'assets/js/*', 'assets/plugins/*', 'assets/public/*']
}).on('readable', function () {
this.stdout.on('data', function (chunk) {
if(/^Express server listening on port/.test(chunk)){
livereload.changed(__dirname);
}
});
this.stdout.pipe(process.stdout);
this.stderr.pipe(process.stderr);
});
});
gulp.task('default', [
'styles',
'scripts',
'develop',
'watch'
]);