-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
46 lines (41 loc) · 1.5 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
var gulp = require('gulp'),
uglify = require("gulp-uglify"),
jshint = require("gulp-jshint"),
rename = require("gulp-rename"),
less = require("gulp-less"),
LessPluginCleanCSS = require('less-plugin-clean-css'),
cleancss = new LessPluginCleanCSS({ advanced: true }),
LessPluginAutoPrefix = require('less-plugin-autoprefix'),
autoprefixer = new LessPluginAutoPrefix({ browsers: ["last 2 versions"] });
// JS
gulp.task('js', function () {
gulp.src(['dashboard/assets/js/**/*.js', '!dashboard/assets/js/**/*.min.js'])
.pipe(jshint())
.pipe(jshint.reporter())
.pipe(uglify().on('error', function(err){ console.log(err.message); }))
.pipe(rename({ suffix: ".min" }))
.pipe(gulp.dest('dashboard/assets/js'));
});
// Less
gulp.task('less', function () {
gulp.src('dashboard/assets/less/style.less')
.pipe(less({
plugins: [autoprefixer, cleancss]
}).on('error', function(err){ console.log(err.message); }))
.pipe(gulp.dest('dashboard/assets/css'));
});
// ncg-dash
gulp.task('ncg-dash', function () {
gulp.src('dashboard/ncg-dash/style.less')
.pipe(less({
plugins: [autoprefixer, cleancss]
}).on('error', function(err){ console.log(err.message); }))
.pipe(gulp.dest('dashboard/ncg-dash'));
});
// Watchers
gulp.task('watch', function () {
gulp.watch(['dashboard/assets/js/**/*.js', '!dashboard/assets/js/**/*.min.js'], ['js']);
gulp.watch(['dashboard/assets/less/*'], ['less']);
gulp.watch(['dashboard/ncg-dash/*', '!dashboard/ncg-dash/*.css'], ['ncg-dash']);
});
gulp.task('default', ['watch']);