-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpFile.js
62 lines (50 loc) · 1.64 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
//this file is more for example app....extract widget app bits later in a separate file
var gulp = require('gulp');
var html2js = require('gulp-html2js');
var browserSync = require('browser-sync');
var reload = browserSync.reload;
var concat = require('gulp-concat');
var styleInject = require('gulp-style-inject');
var SOURCEPATHS = {
htmlSource : 'src/index.html',
htmlPartialSource : 'src/dynaform/templates/*.html',
cssSource : 'src/dynaform/css/*.css',
jsSource : 'src/**/*.js',
jsonSource: 'src/*.json'
}
gulp.task('html', function(){
return gulp.src('src/dynaform/templates/*.html')
.pipe(styleInject())
.pipe(html2js('temp.js', {
adapter: 'angular',
base: 'src/dynaform/templates',
name: 'widgetApp'
}))
.pipe(gulp.dest('dist/js'));
});
gulp.task('js', ['html'],function(){
return gulp.src(['node_modules/moment/moment.js',
'node_modules/angular-moment/angular-moment.min.js',
'src/dynaform/**/*.js','dist/js/temp.js'])
.pipe(concat('dynaForm.min.js'))
.pipe(gulp.dest('dist/js'))
});
gulp.task('serve', function() {
var files = [
'*.html'
];
browserSync.init(files,{
server: {
baseDir: "./"
}
});
});
gulp.task('reload',function () {
reload() ;
});
gulp.task('watch', [ 'serve', 'js', 'html'], function() {
gulp.watch([SOURCEPATHS.htmlSource,SOURCEPATHS.jsonSource], [ 'reload']);
gulp.watch([SOURCEPATHS.htmlPartialSource,SOURCEPATHS.cssSource], ['html','js', 'reload']);
gulp.watch([SOURCEPATHS.jsSource], ['js','reload']);
});
gulp.task('default', ['watch']);