-
Notifications
You must be signed in to change notification settings - Fork 21
/
gulpfile.js
59 lines (51 loc) · 1.63 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
/*
=========================================================
* 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: './admin_soft/static',
css: './admin_soft/static/css',
scss: './admin_soft/static/scss',
node_modules: './node_modules/',
vendor: './vendor'
}
};
// Compile SCSS
gulp.task('scss', function() {
return gulp.src([paths.src.scss + '/soft-ui-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());
});
// Minify CSS
gulp.task('minify:css', function() {
return gulp.src([
paths.src.css + '/soft-ui-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'));