This repository has been archived by the owner on Jan 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
60 lines (53 loc) · 1.45 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
var gulp = require('gulp');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var minifyCSS = require('gulp-minify-css');
var browserSync = require('browser-sync').create();
var exec = require('child_process').exec;
var staticPath = './static';
gulp.task('image', function () {
return gulp
.src(staticPath + '/img/**/*.{gif,jpg,png,svg}')
.pipe(gulp.dest(staticPath + '/app/img'));
});
gulp.task('sass', function () {
return gulp
.src(staticPath + '/css/*.scss')
.pipe(concat('app.css'))
.pipe(sass())
.pipe(minifyCSS())
.pipe(gulp.dest(staticPath + '/app'))
.pipe(
browserSync.reload({
stream: true,
})
);
});
gulp.task('javascript', function () {
return gulp
.src(staticPath + '/js/*.js')
.pipe(concat('app.js'))
.pipe(uglify())
.pipe(gulp.dest(staticPath + '/app'))
.pipe(
browserSync.reload({
stream: true,
})
);
});
gulp.task('runserver', function () {
var proc = exec('python manage.py runserver');
});
gulp.task('browserSync', ['runserver'], function () {
browserSync.init({
notify: false,
port: 8000,
proxy: 'http://127.0.0.1:8000/',
});
});
gulp.task('watch', ['browserSync', 'sass', 'javascript', 'image'], function () {
gulp.watch('./static/css/*.scss', ['sass']);
gulp.watch('./static/js/*.js', ['javascript']);
gulp.watch('./apps/**/templates/**/*.html', browserSync.reload);
});