-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgulpfile.js
74 lines (64 loc) · 1.96 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
var gulp = require("gulp");
var sass = require("gulp-sass");
var browserSync = require("browser-sync");
var useref = require("gulp-useref");
var gulpIf = require("gulp-if");
var strip = require("gulp-strip-comments");
var cssnano = require("cssnano");
var autoprefixer = require("autoprefixer");
var postcss = require("gulp-postcss");
var uncss = require("postcss-uncss");
var uglify = require("gulp-uglify");
var cache = require("gulp-cache");
var del = require("del");
var runSequence = require("run-sequence");
var rename = require("gulp-rename");
var unused = require("gulp-unused");
var gm = require("gulp-gm");
var newer = require("gulp-newer");
var imgmin = require("gulp-imagemin");
var base64 = require("gulp-base64");
var lozad = require('lozad')
gulp.task("sass", function() {
return gulp
.src("app/scss/**/*.scss") // Gets all files ending with .scss in scss and children dirs
.pipe(sass().on("error", sass.logError)) // Passes it through a gulp-sass, log errors to console
.pipe(gulp.dest("ThemeKit/assets")) // Outputs it in the css folder
.pipe(
browserSync.reload({
pretty: true,
// Reloading with Browser Sync
stream: true
})
);
});
// Watchers
gulp.task("watch", function() {
gulp.watch("app/scss/**/*.scss", ["sass"]);
});
// Default
gulp.task("default", function(callback) {
runSequence(["sass", "css", "watch"]);
});
gulp.task("css", function() {
var plugins = [autoprefixer({ browsers: ["last 1 version"] }), cssnano()];
return gulp
.src("app/css/main.css")
.pipe(postcss(plugins))
.pipe(gulp.dest("app"))
.pipe(gulp.dest("ThemeKit/assets"));
});
// Cleaning
gulp.task("clean", function() {
return del.sync("dist").then(function(cb) {
return cache.clearAll(cb);
});
});
gulp.task("clean:dist", function() {
return del.sync(["dist/**/*"]);
});
// Build Sequences
// ---------------
gulp.task("build", function(callback) {
runSequence("clean:dist", "sass", ["css"], callback);
});