-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathgulpfile.js
62 lines (52 loc) · 1.42 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
var gulp = require('gulp'),
sass = require('gulp-sass'),
jshint = require('gulp-jshint'),
mincss = require('gulp-minify-css'),
postcss = require('gulp-postcss'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
connect = require('gulp-connect');
var autoprefixer = require('autoprefixer'),
cssnext = require('cssnext'),
precss = require('precss');
var processors = [
autoprefixer,
cssnext,
precss,
];
gulp.task("dist",function(){
gulp.src("bookeditor.css")
.pipe(postcss(processors))
.pipe(mincss())
.pipe(rename({
dirname: "",
suffix: ".min"
})).pipe(gulp.dest("./"))
gulp.src("bookeditor.js")
.pipe(uglify())
.pipe(rename({
dirname: "",
suffix: ".min"
})).pipe(gulp.dest("./"));
});
gulp.task("build", function(){
gulp.src("src/bookeditor.scss")
.pipe(sass())
.pipe(gulp.dest("./"))
.pipe(connect.reload());
gulp.src("src/bookeditor.js")
.pipe(jshint())
.pipe(jshint.reporter("default"))
.pipe(gulp.dest("./"))
.pipe(connect.reload());
});
gulp.task("connect", function(){
connect.server({
host: "0.0.0.0",
livereload: true
});
});
gulp.task("default", ["build", "connect"], function(){
gulp.watch("src/**/*.scss", ["build"]);
gulp.watch("src/**/*.js", ["build"]);
});