-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
49 lines (37 loc) · 1.39 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
///////////////////////////////////////////////////
const gulp = require('gulp');
const less = require('gulp-less');
const sourceMaps = require('gulp-sourcemaps');
const cleanCss = require('gulp-clean-css');
const uglify = require('gulp-uglify');
const autoPrefixer = require('gulp-autoprefixer');
//////////////////////////////////////////////////
var lessDir = 'public/assets/source/less/';
var cssDir = 'public/assets/dist/styles/';
var jsOut = 'public/assets/dist/scripts/';
var jsDir = 'public/assets/source/scripts/**/*.js';
///////////////////////////////////////////////////
gulp.task('less', () => {
return gulp.src(`${lessDir}main.less`)
.pipe(sourceMaps.init('./'))
.pipe(less())
.pipe(autoPrefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(cleanCss())
.pipe(sourceMaps.write('/'))
.pipe(gulp.dest(cssDir));
});
///////////////////////////////////////////////////////
gulp.task('uglify', () => {
return gulp.src(jsDir)
.pipe(uglify())
.pipe(gulp.dest(jsOut))
});
//////////////////////////////////////////////////////////////
gulp.task('watch', () => {
gulp.watch([`${lessDir}**/*.less`, jsDir], ['less','uglify']);
});
///////////////////////////////////////////////////////
gulp.task('default', ['less', 'uglify','watch']);