forked from ozgrozer/dasper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
38 lines (33 loc) · 1.04 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
var gulp = require('gulp')
var plumber = require('gulp-plumber')
var sourcemaps = require('gulp-sourcemaps')
var sass = require('gulp-sass')
var rename = require('gulp-rename')
var uglify = require('gulp-uglify')
var paths = {
scss: { source: 'assets/css/dev/*.scss', target: 'assets/css/prod/' },
js: { source: 'assets/js/dev/*.js', target: 'assets/js/prod/' }
}
gulp.task('scss', function () {
gulp.src(paths.scss.source)
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(sass({ outputStyle: 'compressed' }))
.pipe(rename({ extname: '.min.css' }))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(paths.scss.target))
})
gulp.task('js', function () {
gulp.src(paths.js.source)
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(rename({ extname: '.min.js' }))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(paths.js.target))
})
gulp.task('watch', function () {
gulp.watch(paths.scss.source, ['scss'])
gulp.watch(paths.js.source, ['js'])
})
gulp.task('default', ['scss', 'js', 'watch'])