-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
49 lines (48 loc) · 1.13 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
var gulp=require('gulp');
var vulcanize=require('gulp-vulcanize');
var connect=require('gulp-connect');
var minifyCss=require('gulp-minify-css');
var autoprefixer=require('gulp-autoprefixer');
var toJson=require('gulp-to-json');
var del=require('del');
gulp.task('vul',function(){
return gulp.src('elements.html')
.pipe(vulcanize({
abspath:'',
stripComments:true,
inlineScripts:true,
inlineCss:true,
}))
.pipe(gulp.dest('build'));
});
gulp.task('clean:images',function(cb){
del([
'build/images/**/*'
],cb);
});
gulp.task('image',['clean:images'],function(){
return gulp.src('images/**/*')
.pipe(gulp.dest('build/images'));
});
gulp.task('css',function(){
return gulp.src('{css,elements}/*.css',{base:'{css,elements}'})
.pipe(autoprefixer({
browsers:['last 2 versions'],
cascade:false,
}))
.pipe(minifyCss())
.pipe(gulp.dest('build/css'));
});
gulp.task('tojson',['image'],function(){
return gulp.src('images/background/*')
.pipe(toJson({
filename:"background.json",
relative:true
}));
});
gulp.task('serve',function(){
connect.server({
port:3000,
livereload:true
});
});