forked from duttyhandsdub/Subrec1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
54 lines (46 loc) · 1.76 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
var gulp = require('gulp');
var sass = require('gulp-sass');
var cssmin = require('gulp-cssmin');
var runSequence = require('run-sequence');
var autoprefixer = require('gulp-autoprefixer');
var sourcemaps = require('gulp-sourcemaps');
var concat = require('gulp-concat');
var sassSources = ['src/wp-content/themes/vpn-view/scss/**/*.scss'];
gulp.task('sass-process', function() {
return gulp.src('src/wp-content/themes/vpn-view/scss/main.scss')
.pipe(sass())
.pipe(concat('style.css'))
.pipe(gulp.dest('src/wp-content/themes/vpn-view'))
});
gulp.task('css-compress', function() {
return gulp.src('src/wp-content/themes/vpn-view/style.css')
.pipe(cssmin())
.pipe(concat('style.css'))
.pipe(gulp.dest('src/wp-content/themes/vpn-view'))
});
gulp.task('css-prefix', function() {
return gulp.src('src/wp-content/themes/vpn-view/style.css')
.pipe(autoprefixer({
browsers: ['IE 9', 'last 2 versions'],
cascade: false
}))
.pipe(gulp.dest('src/wp-content/themes/vpn-view'))
});
gulp.task('css-sourcemap', function() {
return gulp.src('src/wp-content/themes/vpn-view/style.css')
.pipe(sourcemaps.init())
.pipe(sourcemaps.write())
.pipe(gulp.dest('src/wp-content/themes/vpn-view'))
});
gulp.task('css-process-prod', function(callback) {
runSequence('sass-process', 'css-compress', 'css-prefix', callback);
});
gulp.task('css-process-dev', function(callback) {
runSequence('sass-process', 'css-prefix', 'css-compress', 'css-sourcemap', callback);
});
gulp.task('watch-dev', function() {
gulp.watch(sassSources,['css-process-dev']);
});
gulp.task('watch-prod', function() {
gulp.watch('src/wp-content/themes/vpn-view/scss/main.scss',['css-process-prod']);
});