forked from mozilla/webmaker-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
87 lines (74 loc) · 2.72 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
var gulp = require('gulp');
var webserver = require('gulp-webserver');
var sequence = require('run-sequence');
var config = require('./gulp/config');
var clean = require('./gulp/clean');
var downloadLocales = require('./gulp/download-locales');
var locale = require('./gulp/locale');
var template = require('./gulp/template');
var browserify = require('./gulp/browserify');
var less = require('./gulp/less');
var cache = require('./gulp/cache');
var publish = require('./gulp/publish');
var svgmin = require('./gulp/svgmin');
var jsbeautify = require('./gulp/jsbeautify');
var jshint = require('./gulp/jshint');
var jscs = require('./gulp/jscs');
var unit = require('./gulp/unit');
// Config
gulp.task('config', config);
// Prep and static assets
gulp.task('jsbeautify', jsbeautify);
gulp.task('clean', clean);
gulp.task('locale', locale);
gulp.task('download-locales', downloadLocales)
gulp.task('build-locales', function (done) {
sequence('download-locales', 'locale', done);
});
gulp.task('template', ['config'], template);
gulp.task('publish-assets', publish);
gulp.task('build-static', function (done) {
sequence('clean', 'config', ['build-locales', 'publish-assets', 'template'], done);
});
// Browserify
// JS
var browserifyMain = browserify('./lib/index.js', './build/index.js');
var browserifyPublish = browserify('./publish/index.js', './build/publish-assets/index.js');
gulp.task('browserify', ['build-static'], browserifyMain);
gulp.task('browserify-publish', ['build-static'], browserifyPublish);
gulp.task('watchify', ['build-static'], browserify('./lib/index.js', './build/index.js', {sourceMaps: true, watch: true}));
gulp.task('watchify-publish', ['build-static'], browserify('./publish/index.js', './build/publish-assets/index.js', {sourceMaps: true, watch: true}));
// Less
gulp.task('less', less);
gulp.task('watch-less', ['less'], function () {
gulp.watch('./{styles,components,blocks,views}/**/*.less', ['less']);
});
// Build
gulp.task('cache', cache);
gulp.task('build', function (done) {
sequence('build-static', ['browserify', 'browserify-publish', 'less'], 'cache', done);
});
gulp.task('watch', function (done) {
sequence('build-static', ['watchify', 'watchify-publish', 'watch-less'], 'cache', done);
});
// Test
gulp.task('jshint', jshint);
gulp.task('jscs', jscs);
gulp.task('lint', ['jshint', 'jscs']);
gulp.task('unit', ['build'], unit);
gulp.task('unit-no-build', unit);
gulp.task('test', ['lint', 'unit']);
gulp.task('svgmin', svgmin);
// Serve + Watch
gulp.task('dev', ['watch'], function() {
return gulp.src('build')
.pipe(webserver({
host: '0.0.0.0',
port: 8080,
livereload: {
port: 1520,
enable: true
},
fallback: 'index.html'
}));
});