-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
60 lines (51 loc) · 1.6 KB
/
index.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
var autoprefixer = require('gulp-autoprefixer')
, csso = require('gulp-csso')
, fs = require('fs')
, path = require('path')
, plumber = require('gulp-plumber')
, stylus = require('gulp-stylus');
module.exports = function (voyager) {
var AUTOPREFIXER_BROWSERS = [
'ie >= 9'
, 'ie_mob >= 9'
, 'ff >= 30'
, 'chrome >= 34'
, 'safari >= 7'
, 'opera >= 23'
, 'ios >= 7'
, 'android >= 4.1'
, 'bb >= 10'
];
if (fs.existsSync(path.join(voyager.CWD, 'package.json'))) {
var pkg = JSON.parse(fs.readFileSync(path.join(voyager.CWD, 'package.json')));
if (pkg.autoprefixer) {
AUTOPREFIXER_BROWSERS = pkg.autoprefixer;
}
}
voyager.task('write', 'styles', function (done) {
this.src('stylesheets/main.styl')
.pipe(plumber())
.pipe(stylus({ errors: true }))
.pipe(autoprefixer(AUTOPREFIXER_BROWSERS, { cascade: true }))
.pipe(this.out('stylesheets'))
.on('end', done);
});
voyager.task('write', 'styles-vendor', function (done) {
this.src('stylesheets/vendor/**')
.pipe(this.out('stylesheets/vendor'))
.on('end', done);
});
voyager.task('build', 'styles', function (done) {
this.src(['stylesheets/**/*.css', '!stylesheets/vendor/**'])
.pipe(csso())
.pipe(this.out('stylesheets'))
.on('end', done);
});
voyager.task('build', 'styles-vendor', function (done) {
this.src('stylesheets/vendor/**')
.pipe(this.out('stylesheets/vendor'))
.on('end', done);
});
voyager.cancelWatch('stylesheets/**/*.css');
voyager.watch(['stylesheets/**/*.styl', '!stylesheets/vendor/**'], 'styles');
};