-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
49 lines (40 loc) · 1.34 KB
/
gulpfile.js
File metadata and controls
49 lines (40 loc) · 1.34 KB
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
var gulp = require('gulp');
var gls = require('gulp-live-server');
// This is used for CSS
var concat = require('gulp-continuous-concat');
var minifyCss = require('gulp-minify-css');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var watch = require('gulp-watch');
// We want to run certain tasks only when in production
var environments = require('gulp-environments');
var dev = environments.development;
var prod = environments.production;
gulp.task('default', function() {
});
gulp.task('compile-scss', function() {
gulp.src([
'app/stylesheets/**/*.scss',
'!app/stylesheets/**/_*.scss'
])
.pipe(watch('app/stylesheets/**/*.scss'))
.pipe(sourcemaps.init())
.pipe(sass({ indentedSyntax: false, errLogToConsole: true }))
.pipe(concat('application.css'))
.pipe(prod(minifyCss()))
.pipe(sourcemaps.write())
.pipe(gulp.dest('app/static/stylesheets'))
});
gulp.task('serve', ['compile-scss'], function() {
//1. run your script as a server
var server = gls.new('shelf.js');
server.start();
//use gulp.watch to trigger server actions(notify, start or stop)
gulp.watch(['app/**/*.js', 'app/static/**/*.css', 'app/static/**/*.html'], function (file) {
server.start();
});
// Restart the server
gulp.watch('shelf.js', function() {
server.start.bind(server)()
});
});