-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
54 lines (44 loc) · 1.43 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
var gulp = require('gulp'),
clean = require('gulp-clean'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
pump = require('pump');
var base_path = './WebContent',
paths = {
scripts: base_path + '/assets/js',
clean: base_path + '/css/styleEV.css',
input: base_path + '/sass/**/*.scss',
output: base_path + '/css'
};
gulp.task('minify', function() {
pump([
gulp.src(paths.scripts + '/*.js'),
uglify(),
rename(function(path) { path.extname = ".min.js" }),
gulp.dest(paths.scripts)
]);
});
gulp.task('clean', function() {
return gulp.src([paths.clean], { read: false })
.pipe(clean());
});
gulp.task('sass', ['clean'], function() {
var sassOptions = {};
//var sassOptions = { outputStyle: 'compressed' };
return gulp.src(paths.input)
.pipe(sass(sassOptions))
.pipe(gulp.dest(paths.output));
});
gulp.task('postprocess', ['sass'], function() {
return gulp.src(paths.output).pipe(autoprefixer());
});
gulp.task('build', ['postprocess']);
gulp.task('watch', function() {
return gulp.watch(paths.input, ['build'])
.on('change', function(event) {
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
});
});
gulp.task('default', ['build', 'watch']);