forked from app-generator/flask-black-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
72 lines (63 loc) · 1.95 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
/*
=========================================================
* AppSeed - Simple SCSS compiler via Gulp
=========================================================
*/
var autoprefixer = require('gulp-autoprefixer');
var browserSync = require('browser-sync').create();
var cleanCss = require('gulp-clean-css');
var gulp = require('gulp');
const npmDist = require('gulp-npm-dist');
var sass = require('gulp-sass')(require('node-sass'));
var wait = require('gulp-wait');
var sourcemaps = require('gulp-sourcemaps');
var rename = require("gulp-rename");
// Define COMMON paths
const paths = {
src: {
base: './apps/static/assets',
css: './apps/static/assets/css',
scss: './apps/static/assets/scss',
node_modules: './node_modules/',
vendor: './vendor'
}
};
// Compile SCSS
gulp.task('scss', function() {
return gulp.src([paths.src.scss + '/black-dashboard.scss'])
.pipe(wait(500))
.pipe(sourcemaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer({
overrideBrowserslist: ['> 1%']
}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(paths.src.css))
.pipe(browserSync.stream());
});
// CSS
gulp.task('css', function() {
return gulp.src([
paths.src.css + '/black-dashboard.css'
])
.pipe(cleanCss())
.pipe(rename(function(path) {
// Updates the object in-place
path.extname = ".min.css";
}))
.pipe(gulp.dest(paths.src.css))
});
// Minify CSS
gulp.task('minify:css', function() {
return gulp.src([
paths.src.css + '/black-dashboard.css'
])
.pipe(cleanCss())
.pipe(rename(function(path) {
// Updates the object in-place
path.extname = ".min.css";
}))
.pipe(gulp.dest(paths.src.css))
});
// Default Task: Compile SCSS and minify the result
gulp.task('default', gulp.series('scss', 'minify:css'));