forked from smart-components/smart-bubbles
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
69 lines (59 loc) · 1.59 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
/*global -$ */
'use strict';
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var browserSync = require('browser-sync');
var reload = browserSync.reload;
gulp.task('clean', require('del').bind(null,
['.tmp', 'script.js', 'script.min.js', 'style.css']));
gulp.task('serve', ['build'], function () {
browserSync({
notify: false,
port: 9000,
server: {
baseDir: ['.tmp', 'examples'],
routes: {
'/bower_components': 'bower_components'
}
}
});
// watch for changes
gulp.watch([
'src/**/*',
'examples/**/*'
]).on('change', reload);
gulp.watch('src/**/*.js', ['core']);
gulp.watch('src/**/*.css', ['styles']);
gulp.watch('bower.json', ['wiredep']);
});
// inject bower components
gulp.task('wiredep', function () {
var wiredep = require('wiredep').stream;
gulp.src('examples/*.html')
.pipe(wiredep({
ignorePath: /^(\.\.\/)*\.\./
}))
.pipe(gulp.dest('examples'));
});
gulp.task('styles', function() {
return gulp.src('src/**/*.css')
.pipe(gulp.dest('./'))
.pipe(gulp.dest('.tmp'));
});
gulp.task('core', ['styles'], function() {
return gulp.src('src/**/*.js')
.pipe($.jshint())
.pipe($.jshint.reporter('jshint-stylish'))
.pipe(gulp.dest('./'))
.pipe(gulp.dest('.tmp'))
.pipe($.uglify())
.pipe($.concat('script.min.js'))
.pipe(gulp.dest('./'))
.pipe(gulp.dest('.tmp'));
});
gulp.task('build', ['core'], function () {
return gulp.src('src/**/*.js').pipe($.size({title: 'build', gzip: true}));
});
gulp.task('default', ['clean'], function () {
gulp.start('build');
});