This repository has been archived by the owner on Nov 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
43 lines (34 loc) · 1.5 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
'use strict';
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var path = require('path');
var RSBundler = require('@redsift/redsift-bundler');
var bundleConfig = require('./bundle.config.js');
gulp.task('bundle-js', RSBundler.loadTask(gulp, 'bundle-js', bundleConfig));
gulp.task('bundle-css', RSBundler.loadTask(gulp, 'bundle-css', bundleConfig));
gulp.task('build', ['bundle-js', 'bundle-css'], function(cb) {
console.log('\n* Bundling complete:\n');
RSBundler.printBundleSummary(bundleConfig);
});
var serveDirs = [ './examples', './dist' ];
gulp.task('browser-sync', function() {
browserSync.init({
server: {
baseDir: serveDirs,
directory: true
}
});
});
gulp.task('watch', function() {
gulp.watch(['./src/**/*.js', './src/**/*.styl'], ['build']);
gulp.watch('./dist/**/*.js').on('change', () => browserSync.reload('*.js'));
gulp.watch('./dist/**/*.css').on('change', () => browserSync.reload('*.css'));
gulp.watch('./examples/*.html').on('change', () => browserSync.reload('*.html'));
});
gulp.task('serve', [ 'build', 'browser-sync' ], function() {
gulp.watch(['./src/**/*.js', './src/**/*.styl'], ['build']);
gulp.watch('./dist/**/*.js').on('change', () => browserSync.reload('*.js'));
gulp.watch('./dist/**/*.css').on('change', () => browserSync.reload('*.css'));
gulp.watch('./examples/*.html').on('change', () => browserSync.reload('*.html'));
});
gulp.task('default', [ 'build', 'serve', 'watch' ]);