-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
58 lines (47 loc) · 1.46 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
55
56
57
58
// load plugins
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var concat = require('gulp-concat');
var clean = require('gulp-clean');
var sass = require('gulp-sass');
var prefix = require('gulp-autoprefixer');
var minifyCSS = require('gulp-minify-css');
// styles
gulp.task('styles', function() {
gulp.src('src/stylesheets/index.scss')
.pipe(sass())
.pipe(prefix('last 1 version', '> 1%', 'ie 8'))
.pipe(gulp.dest('dest/stylesheets/'));
});
// scripts
gulp.task('scripts', function() {
gulp.src('src/javascripts/track-focus.js')
.pipe(gulp.dest('dest/javascripts/'))
.pipe(uglify({ preserveComments: 'some' }))
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('dest/javascripts/'));
});
gulp.task('polyfills', function() {
gulp.src('src/javascripts/polyfills/*.js')
.pipe(concat('polyfills.js'))
.pipe(gulp.dest('dest/javascripts/'))
.pipe(uglify())
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('dest/javascripts/'));
});
// clean
gulp.task('clean', function(){
gulp.src(['dest/javascripts/*', 'dest/stylesheets/*'], { read: false })
.pipe(clean());
});
// default task
gulp.task('default', ['clean'], function() {
gulp.start('styles', 'polyfills', 'scripts');
});
// watch
gulp.task('watch', function() {
gulp.watch('src/stylesheets/*.scss', ['styles']);
gulp.watch(['src/javascripts/polyfills/*.js'], ['polyfills']);
gulp.watch(['src/javascripts/track-focus.js'], ['scripts']);
});