-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
54 lines (44 loc) · 1.65 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
var gulp = require('gulp'),
//webpack = require('gulp-webpack'),
source = require('vinyl-source-stream'),
path = require('path'),
config = require('./gulp.config')();
var _ = require('lodash');
var webpack = require('./webpack.config.js');
var gulpPlugin = require('gulp-load-plugins')({lazy: false});
/** Angular app js files **/
gulp.task('appJs', function () {
return gulp.src(config.jsOrder)
//.pipe(gulpPlugin.uglify({
// mangle: false,
//compress: false
//}))
.pipe(gulpPlugin.concatUtil('application.js'))
.pipe(gulp.dest(config.frontend.scripts));
});
/** Angular templates which are called in views and directives **/
gulp.task('templates', function () {
return gulp.src(config.views.all)
.pipe(gulpPlugin.angularTemplatecache('templates.js', {
standalone: true,
base: function (file) {
return '/' + path.basename(file.relative);
}
}))
.pipe(gulp.dest(config.frontend.scripts));
});
gulp.task('web-pack', ['scripts'], function() {
return gulp.src(config.main)
.pipe(gulpPlugin.webpack(webpack))
.pipe(gulp.dest(config.frontend.scripts));
});
var filestoWatch = _.flatten([config.views.all, config.js, config.lessDir]);
gulp.task('watch', function() {
return gulp.watch(filestoWatch, ['web-pack']);
//return gulp.src(filestoWatch)
//.pipe(gulpPlugin.webpack(_.assign({}, webpack, { watch: true })))
//.pipe(gulp.dest(config.frontend.scripts));
});
/** Runs all application js tasks */
gulp.task('scripts', ['appJs', 'templates']);
gulp.task('default', ['web-pack', 'watch']);