-
Notifications
You must be signed in to change notification settings - Fork 6
/
gulpfile.js
62 lines (52 loc) · 1.4 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
var gulp = require('gulp'),
uglify = require('gulp-uglify'),
nodemon = require('gulp-nodemon'),
minifyCSS = require('gulp-minify-css'),
less = require('gulp-less'),
prefix = require('gulp-autoprefixer');
var paths = {
images: 'src/images/*',
scripts: 'src/js/*.js',
less: 'src/less/*.less'
};
/**/
gulp.task('scripts', function() {
return gulp.src(paths.scripts)
//.pipe(uglify())
.pipe(gulp.dest('public/static/js'));
});
gulp.task('images', function() {
return gulp.src(paths.images)
// Pass in options to the task
//.pipe(imagemin({optimizationLevel: 5}))
.pipe(gulp.dest('public/static/images'));
});
gulp.task('less', function() {
return gulp.src(paths.less)
.pipe(less({
keepSpecialComments: 0,
}))
.pipe(prefix({
browsers: ['> 0%', 'last 2 versions', 'Firefox ESR', 'Opera 12.1'],
cascade: true
}))
.pipe(gulp.dest('public/static/css'));
});
gulp.task('watch', function() {
gulp.watch(paths.scripts, ['scripts']);
gulp.watch(paths.images, ['images']);
gulp.watch(paths.less, ['less']);
});
gulp.task('develop', function() {
nodemon({
script: 'server.js',
ext: 'html js',
ignore: ['src/**', 'public/**']
})
.on('restart', function() {
console.log('restarted!');
});
});
gulp.task('default', ['scripts', 'images', 'watch', 'less', 'develop'], function() {
console.log("Gulp is starting...");
});