-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
68 lines (59 loc) · 1.63 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
'use strict';
var gulp = require('gulp');
var stylus = require('gulp-stylus');
var rename = require('gulp-rename');
var browserify = require('gulp-browserify');
var replace = require('gulp-replace');
var notify = require('gulp-notify');
gulp.task('stylus', function() {
gulp.src('./assets/app/app.styl')
.pipe(
stylus({
use: ['nib'],
compress: false
})
.on('error', notify.onError(function (error) {
return "Stylus Error: " + error.message;
}))
)
.pipe(gulp.dest('./.tmp/public/styles/'));
});
gulp.task('browserify', function() {
gulp.src('./assets/app/app.js')
.pipe(
browserify({
insertGlobals: true,
debug: true,
entry: true
})
.on('error', notify.onError(function (error) {
return "Browserify Error: " + error.message;
}))
)
.pipe(replace('\/\/# sourceMappingURL=angular.min.js.map', ''))
.pipe(rename('app.js'))
.pipe(gulp.dest('./.tmp/public/js/'));
});
gulp.task('copy-images', function() {
gulp.src('./assets/images/*')
.pipe(gulp.dest('./.tmp/public/images/'));
});
gulp.task('copy-html', function() {
gulp.src('./assets/**/*.html')
.pipe(gulp.dest('./.tmp/public/'));
});
gulp.task('default', function() {
gulp.run('stylus', 'browserify', 'copy-images', 'copy-html');
gulp.watch('./assets/**/*.js', function() {
gulp.run('browserify');
});
gulp.watch('./assets/images/*', function() {
gulp.run('copy-images');
});
gulp.watch('./assets/**/*.html', function() {
gulp.run('copy-html');
});
gulp.watch('./assets/**/*.styl', function() {
gulp.run('stylus');
});
});