-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gulpfile.js
50 lines (50 loc) · 1.53 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
const gulp = require('gulp');
const sass = require('gulp-sass')(require('sass'));
const sourcemaps = require('gulp-sourcemaps');
const autoprefixer = require('gulp-autoprefixer');
const concat = require('gulp-concat');
const replace = require('gulp-replace');
const resource_dir = "./public_html/wp-content/themes/premise/";
const logfile = "./public_html/sass.log.txt";
const source_dir = "sourcemaps/";
const files = resource_dir + "sass/**/*.scss";
const prodOutput = resource_dir;
const devOutput = resource_dir + "devcss/";
var devOptions = {
errLogToConsole : true,
outputStyle : 'expanded',
stdout : false,
stderr : false,
};
var prodOptions = {
outputStyle: 'compressed'
};
function dev() {
return (
gulp
.src(files)
.pipe(sourcemaps.init())
.pipe(sass(devOptions))
.pipe(autoprefixer())
.pipe(concat('style.css'))
.pipe(sourcemaps.write(source_dir))
.pipe(gulp.dest(devOutput))
);
}
exports.dev = dev;
function watch() {
gulp.watch(files, dev);
}
exports.watch = watch;
function prod() {
return (
gulp
.src(files)
.pipe(sass(prodOptions))
.pipe(autoprefixer())
.pipe(concat('style.css'))
.pipe(replace(/\.\.\//g, './'))
.pipe(gulp.dest(prodOutput))
);
}
exports.prod = prod;