-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
31 lines (27 loc) · 1.03 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
// Build for our client - adds a 'build' command to our grunt commands that browserifies our client.
var gulp = require('gulp');
var browserify = require('gulp-browserify');
var inject = require("gulp-inject");
var concat = require('gulp-concat');
// Inject scripts
gulp.task('injectScripts', ['browserify'], function () {
var target = gulp.src('./views/admin/layout.html');
var sources = gulp.src(['./public/admin/build/js/main.js', './public/build/**/*.css'], {read: false});
return target.pipe(inject(sources))
.pipe(gulp.dest('./views/admin'));
});
// Browserify - concatenates the browserify files and dumps them in app.js
gulp.task('browserify', function() {
var b = browserify({
debug: true,
exclude : ['models']
});
var target = gulp.src(['./public/admin/javascripts/main.js'])
.pipe(b)
// Bundle to a single file
.pipe(concat('main.js'))
// Output it to our dist folder
.pipe(gulp.dest('./public/admin/build/js'));
return target;
});
gulp.task('build-client',['browserify','injectScripts']);