-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
96 lines (88 loc) · 2.19 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
var gulp = require('gulp');
var haml = require('gulp-ruby-haml');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var autoprefixer = require('gulp-autoprefixer');
var concat = require('gulp-concat');
var coffee = require('gulp-coffee');
var uglify = require('gulp-uglify');
var browserSync = require('browser-sync');
var reload = browserSync.reload;
gulp.task('haml', function() {
gulp.src('_haml/**/*.haml')
.pipe(haml())
.on('error', function (err) {
console.log(err);
this.emit('end');
})
.pipe(gulp.dest('./'));
});
gulp.task('sass', function() {
gulp.src('assets/_sass/**/*.sass')
.pipe(sourcemaps.init())
.pipe(sass({
indentedSyntax: true,
outputStyle: 'compressed',
errLogToConsole: true,
includePaths: [
'node_modules/susy/sass/'
]
}))
.pipe(autoprefixer())
.pipe(sourcemaps.write())
.pipe(gulp.dest('assets/css/'))
.pipe(reload({stream: true}));
});
gulp.task('coffee', function() {
gulp.src([
// This is like the Rails asset pipeline JS manifest
'assets/_coffee/global.coffee',
])
.pipe(sourcemaps.init())
.pipe(concat('main.coffee'))
.pipe(coffee({bare: true}).on('error', function (err) {
console.log(err);
this.emit('end');
}))
.pipe(sourcemaps.write())
.pipe(gulp.dest('assets/js/'));
});
gulp.task('uglify', function() {
return gulp.src('assets/js/main.js')
.pipe(uglify())
.pipe(gulp.dest('assets/js/'));
});
gulp.task('browser-sync', function() {
browserSync({
notify: false,
files: [
'_site/assets/css/*.css',
'_site/assets/media/**',
'_site/assets/js/**/*.js',
'_site/**/*.html'
],
ghostMode: {
clicks: true,
forms: true
},
open: false,
logLevel: 'debug',
server: {
baseDir: '_site'
}
});
});
gulp.task('watch', function() {
gulp.watch('_haml/**/*.haml', ['haml']);
gulp.watch('assets/_sass/**/*.sass', ['sass']);
gulp.watch('assets/_coffee/**/*.coffee', ['coffee']);
});
// Default Task
gulp.task('default', [
'haml',
'sass',
'coffee',
'uglify',
'browser-sync',
'watch'
]);