forked from orchestral/foundation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
50 lines (43 loc) · 1.27 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
var gulp = require('gulp'),
gutil = require('gulp-util'),
coffee = require('gulp-coffee'),
csso = require('gulp-minify-css'),
less = require('gulp-less'),
rename = require('gulp-rename'),
uglify = require('gulp-uglify');
// Less
gulp.task('css', function () {
return gulp.src('public/css/orchestra.less')
.pipe(less())
.pipe(csso())
.pipe(gulp.dest('public/css'));
});
// Coffee
gulp.task('js', function () {
return gulp.src('public/js/orchestra.coffee')
.pipe(coffee().on('error', gutil.log))
.pipe(gulp.dest('public/js'));
});
// Minify JavaScript
gulp.task('uglify', function () {
var options = {
outSourceMaps: false,
output: {
max_line_len: 150
}
};
return gulp.src('public/js/orchestra.js')
.pipe(rename({suffix: '.min'}))
.pipe(uglify(options))
.pipe(gulp.dest('public/js'))
});
// Add file watch
gulp.task('watch', function () {
gulp.watch('public/css/orchestra.less', ['css']);
gulp.watch('public/css/orchestra.coffee', ['js']);
gulp.watch('public/css/orchestra.js', ['uglify']);
});
// Default task.
gulp.task('default', ['css', 'js', 'uglify', 'watch']);
// Run default without watch.
gulp.task('run', ['css', 'js', 'uglify']);