-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgulpfile.babel.js
More file actions
64 lines (50 loc) · 1.54 KB
/
gulpfile.babel.js
File metadata and controls
64 lines (50 loc) · 1.54 KB
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
import gulp from 'gulp';
var config = {};
config.template = 'app/template/pages/index.jade';
config.style = 'app/style/common.css';
config.images = 'app/images/*.jpg';
config.buildDir = 'build/';
// tasks
gulp.task('template', () => {
let jade = require('gulp-jade');
gulp.src(config.template)
.pipe(jade({
pretty: true
}))
.pipe(gulp.dest(config.buildDir));
});
gulp.task('style', () => {
let vars = require('./app/style/variables.js');
let postcss = require('gulp-postcss'),
simpleVars = require('postcss-simple-vars'),
nested = require('postcss-nested'),
autoprefixer = require('autoprefixer-core');
let postProcessors = [
autoprefixer({ browser: [
'> 1%', 'last 2 versions',
'Firefox ESR', 'Opera 12.1',
'ie 8', 'ie 9'
] }),
simpleVars({ variables: vars }),
nested()
];
gulp.src(config.style)
.pipe(postcss(postProcessors))
.pipe(gulp.dest(config.buildDir));
});
gulp.task('images', () => {
gulp.src(config.images)
.pipe(gulp.dest(config.buildDir + '/img/'));
});
gulp.task('watch', () => {
gulp.watch('./*.jade', ['template']);
gulp.watch('./*.css', ['style']);
});
gulp.task('open', () => {
let open = require('gulp-open');
gulp.src(config.buildDir + './index.html')
.pipe(open('<%file.path%>'));
});
gulp.task('build', ['template', 'style', 'images']);
gulp.task('develop', ['build', 'watch']);
gulp.task('default', ['build']);