forked from lukesnowden/FSVS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGulpfile.js
87 lines (74 loc) · 1.89 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
var gulp = require('gulp'),
autoprefixer = require('gulp-autoprefixer'),
cache = require('gulp-cache'),
clean = require('gulp-clean'),
concat = require('gulp-concat'),
minifyCSS = require('gulp-minify-css'),
plumber = require('gulp-plumber'),
rename = require('gulp-rename'),
sass = require('gulp-ruby-sass'),
sequence = require('run-sequence'),
uglify = require('gulp-uglify'),
/**
* If developing this package set to true but make sure you change it to false before
* deploying and re-run gulp
*/
local = true,
destination = 'assets/';
/**
* setup stream for package's sass files
* @return gulp object
*/
gulp.task( 'styles', function()
{
var _gulp = gulp.src( 'scss/**/*.scss' )
.pipe( plumber() )
.pipe( sass() )
.pipe( autoprefixer( 'last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4' ) );
// don't bother with source map rubbish...
if( ! local ) _gulp.pipe( minifyCSS() );
_gulp.pipe( gulp.dest( destination + 'css' ) );
return _gulp;
});
/**
* setup stream for package's javascript files
* @return gulp object
*/
gulp.task( 'scripts', function()
{
var _gulp = gulp.src([
'js/fsvs.js'
])
.pipe( plumber() )
.pipe( concat( 'bundle.js' ) );
if( ! local ) _gulp.pipe( uglify() );
_gulp.pipe( gulp.dest( destination + 'js' ) );
return _gulp;
});
/**
* [description]
* @return {[type]} [description]
*/
gulp.task( 'clean', function()
{
return gulp.src([
destination + 'css',
destination + 'js'
], { read: false } )
.pipe( clean({ force : true }) );
});
/**
* [description]
* @return {[type]} [description]
*/
gulp.task( 'watch', function () {
gulp.watch( 'scss/**/*.scss', ['styles']);
gulp.watch( 'js/*.js', ['scripts'] );
});
/**
* [description]
* @return {[type]} [description]
*/
gulp.task( 'default', ['clean'], function() {
sequence( 'styles', 'scripts' );
});