-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
52 lines (49 loc) · 1.38 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
var gulp = require('gulp'),
less = require('gulp-less'),
cssmin = require('gulp-cssmin'),
server = require('gulp-webserver'),
browserify = require('browserify'),
source = require('vinyl-source-stream'),
concat = require('gulp-concat');
var paths = {
less: './src/less',
css_build: './dist/css',
js: './src/js',
js_build: './dist/js'
};
gulp.task('less', function () {
gulp.src(paths.less + '/app.less')
.pipe(less())
.pipe(gulp.dest(paths.css_build));
});
gulp.task('minify', function () {
gulp.src(paths.css_build + '/*.css')
.pipe(cssmin())
.pipe(gulp.dest(paths.css_build));
});
gulp.task('concat', function () {
gulp.src(paths.js + '/*.js')
.pipe(concat('app_concat.js'))
.pipe(gulp.dest(paths.js_build));
});
gulp.task('server', function () {
gulp.src('./')
.pipe(server(
{
livereload: true,
open: true
}
));
});
gulp.task('browserify', function () {
browserify({
entries: [paths.js_build + '/app_concat.js']
})
.bundle()
.pipe(source('app.js'))
.pipe(gulp.dest(paths.js_build));
});
gulp.task('default', ['server', 'less', 'concat', 'browserify'], function() {
gulp.watch(paths.less + '/*.less', ['less']);
gulp.watch(paths.js + '/*.js', ['concat', 'browserify']);
});