forked from kristoferjoseph/flexboxgrid
-
Notifications
You must be signed in to change notification settings - Fork 88
/
Gulpfile.js
75 lines (66 loc) · 1.88 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
/*global -$ */
'use strict';
var gulp = require('gulp'),
$ = require('gulp-load-plugins')(),
jade = require('jade'),
gulpJade = require('gulp-jade');
jade.filters.code = function( block ) {
return block
.replace( /&/g, '&' )
.replace( /</g, '<' )
.replace( />/g, '>' )
.replace( /"/g, '"' );
};
gulp.task('jade:demo', function () {
return gulp.src('./demo/*.jade')
.pipe(gulpJade({
jade: jade,
pretty: true
}))
.pipe(gulp.dest('./demo/'));
});
gulp.task('styles:demo', function () {
return gulp.src('demo/sass/*')
.pipe($.sourcemaps.init())
.pipe($.sass({
outputStyle: 'nested',
precision: 10,
includePaths: ['.', 'bower_components'],
onError: console.error.bind(console, 'Sass error:')
}))
.pipe($.sourcemaps.write())
.pipe(gulp.dest('demo'));
});
gulp.task('styles:dist', function () {
return gulp.src('*.scss')
.pipe($.sourcemaps.init())
.pipe($.sass({
outputStyle: 'nested',
precision: 10,
includePaths: ['.', 'bower_components'],
onError: console.error.bind(console, 'Sass error:')
}))
.pipe($.sourcemaps.write())
.pipe(gulp.dest('dist'));
});
gulp.task('clean', require('del').bind(null, ['dist']));
gulp.task('watch', ['jade:demo', 'styles:demo', 'styles:dist'], function () {
// watch for changes
gulp.watch('demo/*.jade', ['jade:demo']);
gulp.watch('*.scss', ['styles:dist']);
gulp.watch('bower_components/**/*.scss', ['styles:dist']);
gulp.watch('demo/sass/*.scss', ['styles:demo']);
gulp.watch('bower.json', ['wiredep']);
});
// inject bower components
gulp.task('wiredep', function () {
var wiredep = require('wiredep').stream;
gulp.src('src/sass/*.scss')
.pipe(wiredep({
ignorePath: /^(\.\.\/)+/
}))
.pipe(gulp.dest('dist'));
});
gulp.task('default', function () {
gulp.start('watch');
});