-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
72 lines (64 loc) · 2 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
var gulp = require('gulp');
var gutil = require('gulp-util');
var coffee = require('gulp-coffee');
// var wiredep = require('wiredep');
// var rename = require('gulp-rename');
// var uglify = require('gulp-uglify');
// var concat = require('gulp-concat');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
// var exec = require('child_process').exec;
var browserSync = require('browser-sync').create();
var nodemon = require('gulp-nodemon');
// Load configuration
// var config = require('./gulp-config');
// Transpile Sass
gulp.task('sass', function () {
gulp.src('./src/scss/*.scss')
.pipe(sourcemaps.init())
.pipe(sass({
outputStyle: 'compressed',
includePaths: [require('node-bourbon').includePaths, './node_modules/susy/sass','./node_modules/breakpoint-sass/stylesheets']
}).on('error', sass.logError))
.pipe(sourcemaps.write('./maps'))
.pipe(gulp.dest('./public/css'))
.pipe(browserSync.stream());
});
// Transpile Coffee
gulp.task('coffee', function() {
gulp.src('./src/coffee/*.coffee')
.pipe(sourcemaps.init())
.pipe(coffee({bare: true}).on('error', gutil.log))
.pipe(sourcemaps.write('./maps'))
.pipe(gulp.dest('./public/js'))
.pipe(browserSync.stream());
});
// browserSync
// Static Server + watching scss/html files
gulp.task('serve', ['sass', 'coffee'], function() {
gulp.watch('./src/coffee/*.coffee', ['coffee']);
gulp.watch('./src/scss/*.scss', ['sass']);
var started = false;
return nodemon({
script: 'index.js',
ext: 'js html'
}).on('start', function () {
// to avoid nodemon being started multiple times
if (!started) {
cb();
started = true;
}
});
});
gulp.task('browser-sync', ['serve'], function() {
browserSync.init(null, {
proxy: "http://localhost:5000",
files: ["public/**/*.*"],
port: 7000,
ghostmode: false,
notify: false,
open: false
});
});
// The default task (called when you run `gulp` from cli)
gulp.task('default', ['browser-sync']);