forked from ink-zone/fexo
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
51 lines (45 loc) · 1.33 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
'use strict';
var gulp = require('gulp');
var sass = require('gulp-sass');
var postcss = require('gulp-postcss');
var sourcemaps = require('gulp-sourcemaps');
var autoprefixer = require('autoprefixer');
var reveasy = require('gulp-rev-easy');
var path = require('path');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
gulp.task('default', ['sass', 'scripts'], function() {
gulp.watch('./source/sass/**/*.scss', ['sass']);
gulp.watch('./source/js/**/*.js', ['scripts']);
});
gulp.task('sass', function() {
return gulp.src('./source/sass/*.scss')
.pipe(sourcemaps.init())
.pipe(sass({
outputStyle: 'compressed'
}).on('error', sass.logError))
.pipe(postcss([autoprefixer()]))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./source/css'));
});
gulp.task('scripts', function() {
var files = [
'./source/js/fastclick.js',
'./source/js/scroll-spy.js',
'./source/js/zenscroll.js',
'./source/js/util.js',
'./source/js/app.js'
];
return gulp.src(files)
.pipe(concat('bundle.js'))
.pipe(uglify())
.pipe(gulp.dest('./source/js'));
});
gulp.task('rev', function(argument) {
gulp.src('./layout/_partial/style.ejs')
.pipe(reveasy({
base: path.join(process.cwd(), 'source'),
fileTypes: ['css', 'js']
}))
.pipe(gulp.dest('./layout/_partial'))
})