-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
70 lines (60 loc) · 1.72 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
70
var gulp = require("gulp"),
util = require("gulp-util"),
runSequence = require('run-sequence'),
sass = require("gulp-sass"),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
jslint = require('gulp-jslint'),
source = require('vinyl-source-stream'),
browserify = require('browserify'),
uglify = require('gulp-uglify'),
log = util.log,
path = require('path'),
config = require('./config');
/******************/
/****** CSS *******/
gulp.task('sass', function(){
log("**** Compiling CSS");
return gulp.src(config.files.css)
.pipe(sass({ outputStyle: 'expanded'}))
.pipe(autoprefixer('last 2 version'))
.pipe(gulp.dest(config.paths.css))
});
gulp.task('cssmin', function(){
log("**** Minifying CSS");
return gulp.src(config.files.main_css)
.pipe(minifycss())
.pipe(gulp.dest(config.paths.css));
});
/******************/
/******* JS *******/
gulp.task('browserify', function(){
log("**** Browserify");
return browserify(config.files.app_js).bundle()
.pipe(source('app.min.js'))
.pipe(gulp.dest(config.paths.js));
});
gulp.task('uglify', function(){
log("**** Uglify");
return gulp.src(config.files.app_min_js)
.pipe(uglify())
.pipe(gulp.dest(config.paths.js));
});
gulp.task('jslint', function(){
log("**** jslint");
return gulp.src(config.files.app_min_js)
.pipe(jslint())
.pipe(gulp.dest(config.paths.js));
});
gulp.task('watch', function(){
gulp.watch(config.files.js, ['browserify']);
gulp.watch(config.files.css, ['sass']);
})
/*********************************/
/******* Dev and Prd tasks *******/
gulp.task('prd', function(){
runSequence('sass', 'browserify', 'cssmin', 'uglify');
});
gulp.task('default', function(){
runSequence('sass', 'browserify', 'watch');
});