-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
38 lines (31 loc) · 1.12 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
var gulp = require('gulp');
var bowerFiles = require('main-bower-files');
var inject = require('gulp-inject');
var connect = require('gulp-connect');
var watch = require('gulp-watch');
var less = require('gulp-less');
var gutil = require('gulp-util');
var scriptsMatcher = ['./app/scripts/**/*.js', './app/libs/ace-builds/src-noconflict/ace.js'];
var lessMatcher = ['./app/less/*.less'];
var cssMatcher = ['./app/css/*.css'];
gulp.task('build', ['inject']);
gulp.task('default', ['inject'], function() {
watch(scriptsMatcher.concat(lessMatcher), function() {
gulp.run('inject');
});
});
gulp.task('inject', ['less'], function () {
var scripts = gulp.src(scriptsMatcher, {read: false});
var css = gulp.src(cssMatcher, {read: false});
gulp.src('./index.html')
.pipe(inject(gulp.src(bowerFiles(), {read: false}), {name: 'bower', addRootSlash: false}))
.pipe(inject(scripts, {addRootSlash: false}))
.pipe(inject(css, {addRootSlash: false}))
.pipe(gulp.dest('./'));
});
gulp.task('less', function() {
gulp.src(lessMatcher)
.pipe(less())
.on('error', gutil.log)
.pipe(gulp.dest('./app/css'));
});