-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gulpfile.js
42 lines (36 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
// grab our packages
var gulp = require('gulp'),
minifyHTML = require('gulp-minify-html'),
minifyCss = require('gulp-minify-css'),
minifyJavaScript = require('gulp-minify'),
preprocess = require('gulp-preprocess'),
open = require('gulp-open');
gulp.task('prod', ['html','img','minify-css', 'minify-javascript', 'open']);
gulp.task('minify-css', function() {
return gulp.src('src/css/*.css')
.pipe(minifyCss({compatibility: 'ie8'}))
.pipe(gulp.dest('dist/css'));
});
gulp.task('minify-javascript', function(){
gulp.src('src/js/*.js')
.pipe(minifyJavaScript())
.pipe(gulp.dest('dist/js'))
});
gulp.task('open', function(){
gulp.src('dist/index.html')
.pipe(open());
});
gulp.task('img', function(){
gulp.src('src/img/*')
.pipe(gulp.dest('dist/img'));
});
gulp.task('html', function() {
var opts = {
conditionals: true,
spare:true
};
gulp.src('src/*.html')
.pipe(preprocess({context: { NODE_ENV: 'production', DEBUG: true}})) //To set environment variables in-line
.pipe(minifyHTML(opts))
.pipe(gulp.dest('dist/'))
});