-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
83 lines (72 loc) · 2.09 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*global require:true */
(function () {
'use strict';
var build = 'static/build/';
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var jshint = require('gulp-jshint');
var concat = require('gulp-concat');
var minifyHtml = require('gulp-minify-html');
var minifyCSS = require('gulp-minify-css');
var less = require('gulp-less');
var arenitesrc = require('gulp-arenite-src');
var server = require('gulp-server-livereload');
gulp.task('default', ['html', 'less', 'css', 'js', 'min']);
gulp.task('min', function () {
arenitesrc({
mode: 'dev', //Default is 'dev' anyway but left here for clarity
base: 'static' //So you don't have to use the base folder directly
},
{
export: 'arenite',
imports: {
module: {
module: '.'
}
}
}, function (src) {
src
.pipe(concat('todo.min.js'))
.pipe(uglify({preserveComments: 'some'}))
.pipe(gulp.dest(build));
});
});
gulp.task('js', function () {
gulp.src(['static/js/**/*.js'])
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(concat('todo.js'))
.pipe(gulp.dest(build));
});
gulp.task('html', function () {
gulp.src('static/templates/*.html')
.pipe(minifyHtml())
.pipe(gulp.dest(build));
});
gulp.task('css', function () {
gulp.src('static/css/**/*.css')
.pipe(concat('todo.min.css'))
.pipe(minifyCSS())
.pipe(gulp.dest(build));
});
gulp.task('less', function () {
gulp.src('static/less/**/*.less')
.pipe(less())
.pipe(gulp.dest('css'));
});
gulp.task('watch', function () {
gulp.watch('static/js/**/*.js', ['js', 'min']);
gulp.watch('static/templates/**/*.html', ['html']);
gulp.watch('static/less/**/*.less', ['less']);
gulp.watch('static/css/**/*.css', ['css']);
});
gulp.task('webserver', ['watch'], function () {
gulp.src('static')
.pipe(server({
host: '192.168.1.13',
livereload: true,
directoryListing: true,
open: false
}));
});
}());