forked from NickChen14/slim-angular
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
58 lines (52 loc) · 1.52 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
// Load plugins
var gulp = require('gulp'),
less = require('gulp-less'),
minifycss = require('gulp-minify-css'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
rename = require('gulp-rename'),
notify = require('gulp-notify');
gulp.task('less', function(cb) {
return gulp.src('css/*.less')
.pipe(less())
.pipe(gulp.dest('dist/styles'));
});
// Styles
gulp.task('styles', ['less'], function(cb) {
return gulp.src(
[
'node_modules/bootstrap/dist/css/bootstrap.css',
'dist/styles/*.css'
]
)
.pipe(concat('style.css'))
.pipe(gulp.dest('dist/build'))
.pipe(rename({ suffix: '.min' }))
.pipe(minifycss())
.pipe(gulp.dest('public/minified'));
});
// Scripts
gulp.task('scripts', function() {
return gulp.src([
'node_modules/angular/angular.js',
'node_modules/angular-ui-bootstrap/dist/ui-bootstrap.js',
'node_modules/angular-ui-bootstrap/dist/ui-bootstrap-tpls.js',
'node_modules/angular-cookies/angular-cookies.js',
'node_modules/angular-route/angular-route.js',
'js/*.js'
])
.pipe(concat('app.js'))
.pipe(gulp.dest('dist/scripts'))
.pipe(rename({ suffix: '.min' }))
.pipe(uglify())
.pipe(gulp.dest('public/minified'));
});
// Default task
gulp.task('default', ['less', 'styles', 'scripts']);
// Watch
gulp.task('watch', ['default'], function() {
// Watch .css files
gulp.watch('css/*.less', ['styles']);
// Watch .js files
gulp.watch('js/*.js', ['scripts']);
});