-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
54 lines (48 loc) · 1.75 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
/*global require*/
(function () {
'use strict';
var gulp = require('gulp'),
//gutil = require('gulp-util'),
sass = require('gulp-sass'),
prefix = require('gulp-autoprefixer'),
minifyCss = require('gulp-minify-css'),
concat = require('gulp-concat'),
jshint = require('gulp-jshint'),
rename = require('gulp-rename'),
uglify = require('gulp-uglify');
gulp.task('sass', function () {
return gulp.src('src/sass/*.scss')
.pipe(sass())
.pipe(gulp.dest('dist/css'));
});
gulp.task('css', ['sass'], function () {
gulp.src(['dist/css/*.css'])
.pipe(prefix({cascade: true}))
.pipe(minifyCss())
.pipe(rename('smartbar.min.css'))
.pipe(gulp.dest('dist/css/'));
});
gulp.task('js', function () {
gulp.src(['src/js/*.js'])
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(concat('smartbar.js'))
.pipe(gulp.dest('dist/js/'))
.pipe(rename('smartbar.min.js'))
.pipe(uglify())
.pipe(gulp.dest('dist/js/'));
});
gulp.task('watch', function () {
var watcherCSS = gulp.watch('src/sass/**/*.scss', ['css']),
watcherJS = gulp.watch('src/js/**/*.js', ['js']);
watcherCSS.on('changed', function (event) {
console.log('File ' + event.path + ' was ' + event.type +
', running tasks...');
});
watcherJS.on('changed', function (event) {
console.log('File ' + event.path + ' was ' + event.type +
', running tasks...');
});
});
gulp.task('default', ['js', 'css', 'watch']);
}());