-
Notifications
You must be signed in to change notification settings - Fork 8
/
gulpfile.js
73 lines (60 loc) · 2.13 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
var gulp = require('gulp');
var concat = require('gulp-concat');
var sass = require('gulp-sass');
var rename = require('gulp-rename');
var util = require('gulp-util');
var templateCache = require('gulp-angular-templatecache');
gulp.task('scss', function() {
var appFiles = gulp.src(['demo/scss/demo.scss'])
.pipe(sass().on('error', util.log))
.pipe(rename('demo.css'))
.pipe(gulp.dest('demo/css'));
});
gulp.task('vendor', function() {
var vendorFiles = [
"bower_components/jquery/jquery.js",
"bower_components/angular/angular.js",
"bower_components/moment/moment.js",
"bower_components/lodash/dist/lodash.js",
"bower_components/rrule/lib/rrule.js",
"bower_components/rrule/lib/nlp.js"
];
return gulp.src(vendorFiles)
.pipe(concat('vendor.js'))
.pipe(gulp.dest('demo/.'));
});
gulp.task('app', function() {
return gulp.src(['lib/rrule_recurring_select.js'])
.pipe(concat('app.js'))
.pipe(gulp.dest('demo/.'));
});
gulp.task('template-cache', [], function() {
return gulp.src(['template/**/*.html'])
.pipe(templateCache({ root: 'template', module: 'rrule.templates', standalone: true }))
.pipe(gulp.dest('demo'));
});
gulp.task('compile', ['vendor', 'app']);
gulp.task('build', ['scss', 'compile', 'template-cache']);
gulp.task('dist:js', ['build'], function() {
return gulp.src(['demo/app.js'])
.pipe(concat('rrule_recurring_select.js'))
.pipe(gulp.dest('dist'));
});
gulp.task('dist:js_with_template', ['build'], function() {
return gulp.src(['demo/app.js', 'demo/templates.js'])
.pipe(concat('rrule_recurring_select_templates.js'))
.pipe(gulp.dest('dist'));
});
gulp.task('dist:css', ['scss'], function() {
return gulp.src(['demo/css/demo.css'])
.pipe(concat('rrule_recurring_select.css'))
.pipe(gulp.dest('dist'));
});
gulp.task('dist', ['dist:js', 'dist:js_with_template', 'dist:css']);
gulp.task('watch', function () {
gulp.watch('lib/**/*.js', ['compile']);
gulp.watch('bower_components/**/*.js', ['compile']);
gulp.watch('demo/scss/*.scss', ['scss']);
gulp.watch('template/*.html', ['template-cache']);
});
gulp.task('default', ['build', 'watch']);