-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
52 lines (42 loc) · 1.77 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
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var htmlmin = require('gulp-htmlmin');
var jshint = require('gulp-jshint');
var inlinesrc = require('gulp-inline-source');
var csslint = require('gulp-csslint');
// Note: the '**/' is needed as a prefix to
// preserve the directory structure.
// To move and minify JS assests.
var DEST = 'dist/';
gulp.task('jshint', function() {
return gulp.src(['src/**/*.js', '!**/boot*', '!**/jquery*', '!**/knock*', '!node_modules/', '!node_modules/**', '!dist/', '!dist/**'])
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('js', ['jshint'], function() {
return gulp.src(['src/**/*.js', '!node_modules/', '!node_modules/**', '!dist/', '!dist/**'])
.pipe(uglify())
.pipe(gulp.dest(DEST));
});
gulp.task('img', function() {
return gulp.src(['src/**/*.png', '**/images/*.jpg', '**/images/*.gif', '!node_modules/', '!node_modules/**', '!dist/', '!dist/**'])
.pipe(gulp.dest(DEST));
});
// // just to run csslint, since CSS gets inlined in HTML, and copy over bootstrap
// gulp.task('csslint', function() {
// return gulp.src(['src/**/*.css', '!node_modules/', '!node_modules/**', '!dist/', '!dist/**'])
// .pipe(csslint())
// .pipe(csslint.formatter());
// });
// just to run csslint, since CSS gets inlined in HTML, and copy over bootstrap
gulp.task('css', function() {
return gulp.src(['src/**/boot*.css', '!node_modules/', '!node_modules/**', '!dist/', '!dist/**'])
.pipe(gulp.dest(DEST));
});
gulp.task('html', ['css'], function() {
return gulp.src(['src/index.html', '!dist/', '!dist/**'])
.pipe(inlinesrc())
.pipe(htmlmin({collapseWhitespace: true,minifyJS:true,minifyCSS:false,removeComments:true}))
.pipe(gulp.dest(DEST));
});
gulp.task('main', ['html', 'js', 'img']);