-
Notifications
You must be signed in to change notification settings - Fork 9
/
gulpfile.js
60 lines (46 loc) · 1.54 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
var gulp = require('gulp');
var postcss = require('postcss');
var gulpPostcss = require('gulp-postcss');
var less = require('./');
var gutil = require('gulp-util');
var autoprefixer = require('autoprefixer');
var clean = require('postcss-clean');
var fs = require('fs');
var path = require('path');
gulp.task('test', function() {
var mocha = require('gulp-mocha');
return gulp.src('test/parse.js', { read: false })
.pipe(mocha({ reporter: 'list' }))
.on('error', gutil.log);
});
gulp.task('gulp', function (done) {
var future = require('less-plugin-future-compat');
var reporter = require('postcss-reporter');
return gulp.src('./test/less/comments.less')
.pipe(
gulpPostcss([
less({
plugins: [future]
})
, reporter()
], { parser: less.parser })
)
.on('end', function(){ gutil.log('Done!'); });
});
function testLess(filename, plugins) {
var testFile = fs.readFileSync(path.join(__dirname, 'test/less/' + filename + '.less'), { });
return postcss(plugins).process(testFile.toString(), { parser: less.parser, from: 'test/less/' + filename + '.less' }).then(function (result) {
console.log(result.css);
}, function(err) {
console.log(err.message);
});
}
gulp.task('integration', function(done) {
testLess('tests', [less(), autoprefixer()]);
});
gulp.task('plugins', function(done) {
testLess('plugins', [less({ strictMath: true }), autoprefixer(), clean()]);
});
gulp.task('benchmark', function(done) {
testLess('benchmark', [less()]);
});