-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
81 lines (69 loc) · 1.98 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
'use strict';
var gulp = require('gulp');
// Load plugins
var $ = require('gulp-load-plugins')();
var paths = {
bower: 'bower_components',
css: 'stylesheets/**/*.scss',
scripts: 'scripts/**/*.coffee',
images: 'images/**/*'
};
gulp.task('default', ['clean', 'coffee', 'html', 'styles'], function() {
//start this inside a function rather than the initializer array bc it seems
//like this needs to wait to execute after everything else finishes
gulp.start('webserver');
});
// Out with the old
gulp.task('clean', function () {
return gulp.src(['dist/styles', 'dist/scripts', 'dist/images'],
{read: false}).pipe($.clean());
});
// HTML
gulp.task('html', function () {
return gulp.src('*.html')
// .pipe($.useref())
.pipe(gulp.dest('dist'))
// .pipe($.size())
// .pipe($.connect.reload());
});
// Minify and copy all Coffeescripts (except vendor scripts)
// with sourcemaps all the way down
gulp.task('coffee', function() {
return gulp.src(paths.scripts)
.pipe($.sourcemaps.init())
.pipe($.coffee())
// .pipe(uglify())
// .pipe(concat('all.min.js'))
.pipe($.sourcemaps.write())
.pipe(gulp.dest('dist/scripts'));
});
// Styles
gulp.task('styles', function () {
return gulp.src(paths.css)
.pipe($.rubySass({
style: 'expanded',
loadPath: [paths.bower]
}))
.on('error', function (err) { console.log(err.message); })
.pipe($.autoprefixer('last 1 version'))
.pipe(gulp.dest('dist/styles'))
// .pipe($.size())
// .pipe($.connect.reload());
});
// Server
gulp.task('webserver', function() {
gulp.src('dist')
.pipe($.webserver({
livereload: true,
// directoryListing: true,
// open: true
}));
});
// //
// One Offs //
// //
// Bower helper
gulp.task('bower', function() {
gulp.src('bower_components/**/*.js', {base: 'bower_components'})
.pipe(gulp.dest('dist/bower_components/'));
});