-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
67 lines (48 loc) · 1.8 KB
/
gulpfile.js
File metadata and controls
67 lines (48 loc) · 1.8 KB
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
var gulp = require('gulp'),
tasks = require('gulp-load-tasks')(),
server = require('tiny-lr')();
gulp.task('stylesheets', function () {
gulp.src('app/assets/stylesheets/style.styl')
.pipe(tasks.stylus())
.pipe(tasks.autoprefixer())
.pipe(tasks['if'](gulp.env.production, tasks.csso()))
.pipe(gulp.dest('public/assets/stylesheets/'))
.pipe(tasks.livereload(server));
});
gulp.task('scripts', function () {
gulp.src('app/assets/scripts/app/main.js')
/*.pipe(tasks.jshint())
.pipe(tasks.jshint.reporter('default'))*/
.pipe(tasks.browserify())
.pipe(tasks['if'](gulp.env.production, tasks.uglify()))
.pipe(gulp.dest('public/assets/scripts/'))
.pipe(tasks.livereload(server));
});
gulp.task('images', function () {
gulp.src(['app/assets/images/**/*'])
.pipe(tasks['if'](gulp.env.production, tasks.imagemin({ interlaced: true, progressive: true })))
.pipe(gulp.dest('public/assets/images/'))
.pipe(tasks.livereload(server));
});
gulp.task('workflow', function () {
gulp.src('gulpfile.js')
.pipe(tasks.open('', { url: 'http://localhost:3000' }));
server.listen(35729, function (err) {
gulp.watch('app/assets/stylesheets/**/*.styl', function () {
gulp.run('stylesheets');
});
gulp.watch('app/assets/scripts/**/*.js', function () {
gulp.run('scripts');
});
gulp.watch('app/assets/images/**/*', function () {
gulp.run('images');
});
gulp.watch('app/views/**/*.jade', function () {
gulp.src('').pipe(tasks.livereload(server));
});
});
});
gulp.task('default', function() {
gulp.run('stylesheets', 'scripts', 'images');
gulp.env.production || gulp.run('workflow');
});