-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
57 lines (52 loc) · 1.77 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
const gulp = require("gulp");
const $ = require("gulp-load-plugins")();
const sass = require('gulp-sass');
const rename = require('gulp-rename');
const cleanCSS = require('gulp-clean-css');
const es = require('event-stream');
const srcPattern = [
'default',
'admin'
];
// CSS出力
gulp.task('sass', function() {
let events = srcPattern.map((target) => {
return gulp.src(`./html/template/${target}/assets/scss/**/*.scss`)
.pipe($.plumber({
errorHandler: $.notify.onError('<%= error.message %>')
}))
.pipe($.sourcemaps.init())
.pipe(sass({
sourceMap: true
}))
.pipe($.pleeease({
autoprefixer: true,
minifier: false,
mqpacker: true
}))
.pipe($.sourcemaps.write('./maps'))
.pipe(gulp.dest(`./html/template/${target}/assets/css/`))
});
return es.concat(events);
});
// CSS圧縮(cssディレクトリ直下のファイルだけ対象とする)
gulp.task('minify-css', function() {
let events = srcPattern.map((target) => {
return gulp.src([`./html/template/${target}/assets/css/*.css`, `!./html/template/${target}/assets/css/**/*.min.css`])
.pipe($.plumber({
errorHandler: $.notify.onError('<%= error.message %>')
}))
.pipe($.sourcemaps.init())
.pipe(sass({
sourceMap: true
}))
.pipe(cleanCSS())
.pipe(rename({
extname: '.min.css'
}))
.pipe($.sourcemaps.write('./maps'))
.pipe(gulp.dest(`./html/template/${target}/assets/css/`))
});
return es.concat(events);
});
gulp.task("default", ["sass", "minify-css"]);