forked from rupl/screensizes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
56 lines (50 loc) · 1.78 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
// Gulp tools
var gulp = require('gulp');
var u = require('gulp-util');
var log = u.log;
var c = u.colors;
// Project deps
var nodemon = require('gulp-nodemon');
var sass = require('gulp-sass');
var prefix = require('gulp-autoprefixer');
// Log some debug info
log(c.yellow('Environment:', (process.env.NODE_ENV || 'local')));
log(c.yellow('Visualize Self:', (process.env.VISUALIZE_SELF || 'false')));
// -----------------------------------------------------------------------------
// Sass Task
//
// Compiles Sass and runs the CSS through autoprefixer.
// -----------------------------------------------------------------------------
gulp.task('sass', function() {
return gulp.src('sass/**/*')
.pipe(sass({
outputStyle: 'nested',
})
.on('error', function(err, res) {
log(c.red('sass'), 'failed to compile');
log(c.red('> ') + err.message);
})
)
.pipe(prefix('last 2 versions', '> 1%'))
.pipe(gulp.dest('public/css'));
});
// -----------------------------------------------------------------------------
// Watch tasks
// -----------------------------------------------------------------------------
gulp.task('watch', function() {
gulp.watch('sass/**/*', ['sass']);
});
// -----------------------------------------------------------------------------
// Run the dev server
// -----------------------------------------------------------------------------
gulp.task('start', ['sass', 'watch'], function () {
nodemon({
script: 'index.js',
ext: 'js html dust',
env: { 'NODE_ENV': 'development' }
});
});
// -----------------------------------------------------------------------------
// Default should just start the server
// -----------------------------------------------------------------------------
gulp.task('default', ['start']);