-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
73 lines (60 loc) · 1.62 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
var gulp = require('gulp');
var concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
minifyCSS = require('gulp-minify-css'),
sass = require('gulp-sass'),
clean = require('gulp-clean'),
cache = require('gulp-cached'),
livereload = require('gulp-livereload');
var version = '1.0.0';
var minifyOpts = {
};
var sassOpts = {
includePaths: [
'/Library/Ruby/Gems/2.0.0/gems/compass-0.12.2/frameworks/compass/stylesheets'
]
};
var dst = {
js: 'dist/js',
css: 'dist/css',
sass: './css'
};
var paths = {
js: 'js/**/*.js',
sass: 'scss/**/*.scss',
css: 'css/**/*.css'
};
gulp.task('js', function() {
return gulp.src(paths.js)
.pipe(uglify())
.pipe(concat(version + '.all.js'))
.pipe(gulp.dest(dst.js));
});
gulp.task('sass', function() {
gulp.src(paths.sass)
.pipe(sass(sassOpts))
.pipe(gulp.dest(dst.sass))
.pipe(minifyCSS(minifyOpts))
.pipe(concat(version + '.all.css'))
.pipe(gulp.dest(dst.css));
});
// Rerun the task when a file changes
gulp.task('watch', function() {
var server = livereload(),
liveReloadCallback = function(file) {
setTimeout(function() {
server.changed(file.path);
}, 300);
};
gulp.watch(paths.js, ['js']).on('change', liveReloadCallback);
gulp.watch(paths.sass, ['sass']).on('change', liveReloadCallback);
});
// Clean
gulp.task('clean', function() {
return gulp.src(['dist/*'], {
read: false
}).pipe(clean());
});
gulp.task('default', ['clean'], function() {
return gulp.start('js', 'sass');
});