forked from rsperberg/essential-javascript-links
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
69 lines (60 loc) · 1.81 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
var gulp = require('gulp'),
autoprefixer = require('autoprefixer-core'),
data = require('gulp-data'),
ghPages = require('gh-pages'),
jade = require('gulp-jade'),
lodash = require('lodash'),
postcss = require('gulp-postcss'),
path = require('path'),
sass = require('gulp-sass'),
sourcemaps = require('gulp-sourcemaps'),
watch = require('gulp-watch')
var paths = {
sass: ['./src/sass/**/*.scss'],
assets: ['./src/assets/*.*'],
js: ['./src/js/**/*.js'],
dist: './dist'
};
var cfg = {
autoprefixer: { browsers: ['last 2 version'] },
jade: { pretty: true,
debug: false,
compileDebug: false
}
};
gulp.task('sass', function () {
return gulp.src(paths.sass)
.pipe(sourcemaps.init())
.pipe(sass())
.pipe( postcss([ autoprefixer(cfg.autoprefixer) ]) )
.pipe( sourcemaps.write('maps') )
.pipe( gulp.dest(path.join(paths.dist, 'css')) );
});
gulp.task('assets', function() {
return gulp.src(paths.assets)
.pipe(gulp.dest(paths.dist));
});
gulp.task('templates', function() {
return gulp.src('./src/jade/*.jade')
.pipe(data( function(file) {
var json = {};
json.bigData = require('./src/data/essential-javascript-links.json');
json._ = lodash;
return json;
} ))
.pipe(jade( cfg.jade ))
.pipe(gulp.dest(paths.dist));
});
gulp.task('js', function() {
return gulp.src(paths.js)
.pipe( gulp.dest(path.join(paths.dist, 'js')) );
});
gulp.task('deploy', function() {
ghPages.publish(paths.dist);
});
// Rerun the task when a file changes
gulp.task('watch', function() {
gulp.watch('./src/**/*', ['sass', 'assets', 'templates', 'js']);
});
// The default task (called when you run `gulp` from cli)
gulp.task('default', ['sass', 'assets', 'templates', 'js']);