-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
executable file
·80 lines (67 loc) · 2.16 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
var gulp = require('gulp');
var sass = require('gulp-sass');
var watch = require('gulp-watch');
var minifycss = require('gulp-minify-css');
var rename = require('gulp-rename');
var livereload = require('gulp-livereload');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var autoprefixer = require('gulp-autoprefixer');
var sassFolders = [
'ci_dashboard/assets/scss/*.scss'
];
var stylesheetsPath = 'ci_dashboard/static/ci_dashboard/stylesheets';
/* Compile and minify Sass */
gulp.task('sass', function() {
return gulp.src(sassFolders)
.pipe(sass())
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(concat('application.css'))
.pipe(gulp.dest(stylesheetsPath))
.pipe(rename({suffix: '.min'}))
.pipe(minifycss())
.pipe(gulp.dest(stylesheetsPath))
.pipe(livereload());
});
var BOOTSTRAP = [
'bower_components/bootstrap-sass/assets/javascripts/bootstrap.min.js',
];
var jsFolders = [
'bower_components/jquery/dist/jquery.min.js',
'ci_dashboard/assets/javascripts/*.js'
];
var jsPath = 'ci_dashboard/static/ci_dashboard/javascripts'
gulp.task('js', ['js:bootstrap', 'js:deps']);
gulp.task('js:bootstrap', function() {
return gulp.src(BOOTSTRAP)
.pipe(concat('bootstrap.js'))
.pipe(gulp.dest(jsPath))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest(jsPath))
});
gulp.task('js:deps', function() {
return gulp.src(jsFolders)
.pipe(concat('application.js'))
.pipe(gulp.dest(jsPath))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest(jsPath))
.pipe(livereload());
});
var templatesFolders = [
'**/templates/**'
];
/* Watch Files For Changes */
gulp.task('watch', function() {
livereload.listen();
gulp.watch(sassFolders, ['sass']);
gulp.watch(jsFolders, ['js:deps']);
/* Trigger a live reload on any Django template changes */
gulp.watch(templatesFolders).on('change', livereload.changed);
});
gulp.task('build_static', ['sass', 'js']);
gulp.task('default', ['build_static', 'watch']);