-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
54 lines (49 loc) · 1.32 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
/*jslint node: true */
var gulp = require('gulp'),
CSSPreprocessor = require('gulp-sass'),
JSCompressor = require('gulp-uglify'),
browserSpecificPrefixGenerator = require('gulp-autoprefixer'),
filenames = {
styles: 'style.scss',
javascript: 'main.js'
},
baseFolders = {
source: {
styles: {
sass: 'sass/'
},
javascript: 'js/'
},
target: {
styles: {
css: 'css/'
},
javascript: 'js/'
}
};
/**
* COMPILE CSS
*/
gulp.task('compileCSS', function () {
gulp.src(baseFolders.source.styles.sass + filenames.styles)
.pipe(new CSSPreprocessor().on('error', CSSPreprocessor.logError))
.pipe(new CSSPreprocessor({
outputStyle: 'compressed',
precision: 10
}))
.pipe(browserSpecificPrefixGenerator({browsers: ['last 2 versions']}))
.pipe(gulp.dest(baseFolders.target.styles.css));
});
/**
* COMPRESS JAVASCRIPT
*/
gulp.task('compressJS', function () {
'use strict';
return gulp.src([baseFolders.source.javascript + filenames.javascript])
.pipe(new JSCompressor())
.pipe(gulp.dest(baseFolders.target.javascript));
});
/**
* DEFAULT
*/
gulp.task('default', ['compileCSS', 'compressJS']);