-
Notifications
You must be signed in to change notification settings - Fork 6
/
gulpfile.js
54 lines (49 loc) · 1.51 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
var gulp = require('gulp');
var nib = require('nib');
var stylus = require('gulp-stylus');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var sourcemaps = require('gulp-sourcemaps');
var plumber = require('gulp-plumber');
var paths = {
css: {
main: './lib/public/stylesheets/*.styl',
all: [
'./lib/public/stylesheets/**/*.styl',
'./lib/public/stylesheets/*.styl'
]
},
js: [
'./lib/public/javascripts/namespace.js',
'./lib/public/javascripts/helpers/*.js',
'./lib/public/javascripts/models/*.js',
'./lib/public/javascripts/collections/*.js',
'./lib/public/javascripts/views/*.js',
'./lib/public/javascripts/app/*.js',
'./lib/public/javascripts/routing/*.js',
'./lib/public/javascripts/init.js'
]
};
gulp.task('compile-stylus', function() {
gulp.src(paths.css.main)
.pipe(plumber())
.pipe(stylus({
use: nib()
}))
.pipe(gulp.dest('lib/public/stylesheets/css/'));
});
gulp.task('compile-js', function() {
return gulp.src(paths.js)
.pipe(plumber())
// .pipe(sourcemaps.init())
.pipe(concat('main.bundled.js'))
// .pipe(uglify())
// .pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./lib/public/javascripts/'));
});
gulp.task('watch', function() {
gulp.watch(paths.css.all, ['compile-stylus'])
gulp.watch(paths.js, ['compile-js']);
});
gulp.task('default', ['compile-stylus', 'compile-js']); // Simply compile
gulp.task('watch-files', ['watch', 'compile-stylus', 'compile-js']); // Watch files for changes