-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
83 lines (77 loc) · 2.55 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
71
72
73
74
75
76
77
78
79
80
81
82
83
(function(){
'use strict';
var pkg = require('./package.json'),
gulp = require('gulp'),
rename = require('gulp-rename'),
jade = require('gulp-jade'),
sass = require('gulp-sass'),
cleancss = require('gulp-clean-css'),
jshint = require('gulp-jshint'),
browserSync = require('browser-sync'),
requirejs = require('gulp-requirejs-optimize');
var debug = true;
gulp.task('html', function(){
gulp.src('src/jade/*.jade')
.pipe(jade({
pretty: true,
data: {
debug: false,
name: pkg.name,
keywords: pkg.keywords,
description: pkg.description,
src: require('./source.json')
}
}))
.pipe(gulp.dest('demo'));
});
gulp.task('css', function(){
gulp.src('src/sass/**/*.scss')
.pipe(sass({linefeed: 'crlf'}).on('error', sass.logError))
.pipe(cleancss({compatibility: 'ie8', keepSpecialComments: 0}))
.pipe(gulp.dest('dist/css'))
.pipe(rename({
suffix: ".min",
extname: ".css"
}))
.pipe(gulp.dest('dist/css'));
});
gulp.task('jshint', function(){
gulp.src(['gruntfile.js', 'src/js/main.js', 'src/js/app.js', 'src/js/countdown/*.js'])
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('requirejs', ['jshint'], function(){
gulp.src('src/js/**/*.js')
.pipe(requirejs({
baseUrl: './src/js',
paths: {
jquery: 'empty:'
},
optimize: "uglify",
optimizeCss: "none",
removeCombined: true,
mainConfigFile: "./src/js/main.js"
}))
.pipe(gulp.dest('./dist/js'));
});
gulp.task('default', ['html', 'css', 'jshint', 'requirejs']);
gulp.task('server', ['default'], function() {
browserSync.init({
server: {
baseDir: "./",
index: 'demo/index.html'
},
//startPath: paths.jade.dest,
port: 8888
});
// if(debug) {
// gulp.watch((paths.jade.src), ['html']);
// gulp.watch((paths.scss.src), ['css']);
// gulp.watch((paths.js.src), ['js']);
// }
});
gulp.task('release', function(){
debug = false;
gulp.start('server');
});
}());