-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
69 lines (53 loc) · 1.5 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
62
63
64
65
66
67
68
69
var gulp = require('gulp');
var data = require('gulp-data');
var watch = require('gulp-watch');
var stylus = require('gulp-stylus');
var gulpBrowser = require("gulp-browser");
var nunjucks = require('gulp-nunjucks');
var minify = require('gulp-minifier');
var browserSync = require('browser-sync').create();
gulp.task('default', function() {
gulp.run (['compile-styl']);
gulp.run (['compile-js']);
gulp.run (['compile-html']);
browserSync.init({
server: "./"
});
watch('./dist/css/**/*.styl', function(){
gulp.run (['compile-styl']);
});
watch('./dist/js/**/*.js', function(){
gulp.run (['compile-js']);
});
watch("./dist/templates/**/*.html", function() {
gulp.run (['compile-html']);
});
});
gulp.task('compile-styl', function(){
return gulp.src('./dist/css/style.styl')
.pipe(stylus())
.pipe(gulp.dest('./app/frontend/css/'))
.pipe(browserSync.stream());
});
gulp.task('compile-js', function(){
return gulp.src('./dist/js/*.js')
.pipe(gulpBrowser.browserify())
.pipe(gulp.dest('./app/frontend/js/'));
});
gulp.task('compile-html', function(){
return gulp.src('./dist/templates/index.html')
.pipe(nunjucks.compile())
.pipe(gulp.dest('./'));
});
gulp.task('minify', function(){
return gulp.src('./app/frontend/**/*')
.pipe(minify({
minify: true,
minifyJS: true,
uglifyJS: true,
uglifyCSS: true,
minifyCSS: true,
minifyHTML: true,
collapseWhitespace: true
})).pipe(gulp.dest('./mini'));
});