forked from electricessence/normalize.less
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
65 lines (48 loc) · 1.23 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
var gulp = require('gulp');
var tasks = [];
(function() {
var less = require('gulp-less');
var sourcemaps = require('gulp-sourcemaps');
var srcFolder = 'less', ext = 'less';
var sourceFiles = [srcFolder + '/*.' + ext, '!' + srcFolder + '/_*.' + ext];
var cleancss = new (require("less-plugin-clean-css"))({advanced: true});
var
REL = '.release', MIN = '.min',
NORMAL = tasks[0] = 'less',
NORMAL_MIN = tasks[1] = NORMAL + MIN,
RELEASE = tasks[2] = NORMAL + REL,
RELEASE_MIN = tasks[3] = RELEASE + '.min';
gulp.task(
NORMAL, function() {
gulp.src(sourceFiles)
.pipe(sourcemaps.init())
.pipe(less())
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./css'))
;
});
gulp.task(
RELEASE, function() {
gulp.src(sourceFiles)
.pipe(less())
.pipe(gulp.dest('./css/release'))
;
});
gulp.task(
NORMAL_MIN, function() {
gulp.src(sourceFiles)
.pipe(sourcemaps.init())
.pipe(less({plugins:[cleancss]}))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./css/min'))
;
});
gulp.task(
RELEASE_MIN, function() {
gulp.src(sourceFiles)
.pipe(less({plugins:[cleancss]}))
.pipe(gulp.dest('./css/release/min'))
;
});
})();
gulp.task('default', tasks, function() {});