-
Notifications
You must be signed in to change notification settings - Fork 730
/
gulpfile.js
48 lines (38 loc) · 1.41 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
var browserSync = require('browser-sync').create(),
gulp = require('gulp'),
prefix = require('gulp-autoprefixer'),
sass = require('gulp-sass'),
sourcemaps = require('gulp-sourcemaps');
var HTML = 'zinnia/templates/**/*.html',
THEME = 'zinnia/static/zinnia/theme/sass/**/*.scss',
DASHBOARD = 'zinnia/static/zinnia/admin/dashboard/sass/*.scss';
gulp.task('theme', function() {
browserSync.notify('Compiling theme, please wait !');
return gulp.src(THEME)
.pipe(sourcemaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(prefix())
.pipe(sourcemaps.write())
.pipe(gulp.dest('zinnia/static/zinnia/theme/css'))
.pipe(browserSync.stream());
});
gulp.task('dashboard', function() {
browserSync.notify('Compiling dashboard, please wait !');
return gulp.src(DASHBOARD)
.pipe(sourcemaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(prefix())
.pipe(sourcemaps.write())
.pipe(gulp.dest('zinnia/static/zinnia/admin/dashboard/css'))
.pipe(browserSync.stream());
});
gulp.task('serve', function() {
browserSync.init({
proxy: 'localhost:8000',
serveStatic: ['zinnia/static']
});
gulp.watch(HTML).on('change', browserSync.reload);
gulp.watch(THEME, ['theme']);
gulp.watch(DASHBOARD, ['dashboard']);
});
gulp.task('default', ['serve']);