This repository has been archived by the owner on Apr 2, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
56 lines (49 loc) · 1.58 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
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
minifyCSS = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
rename = require('gulp-rename'),
size = require('gulp-size'),
pkg = require('./package.json');
var paths = {
styles: './scss/style.scss',
scripts: ['./js/main.js']
};
gulp.task('styles', ['components'], function () {
gulp.src(paths.styles)
.pipe(sass({ style: 'expanded' })) // Add source maps after figuring out minify issue
.pipe(rename('app.css'))
.pipe(gulp.dest('./css/'))
.pipe(rename('app.min.css'))
.pipe(minifyCSS())
.pipe(size())
.pipe(gulp.dest('./css/'));
});
gulp.task('components', function() {
return gulp.src(['./bower_components/normalize.css/normalize.css'])
.pipe(rename('_normalize.scss'))
.pipe(gulp.dest('./bower_components/normalize.css/'));
});
gulp.task('scripts', ['lint'], function() {
gulp.src(paths.scripts)
.pipe(concat('app.js'))
.pipe(gulp.dest('./js/'))
.pipe(rename('app.min.js'))
.pipe(uglify({ preserveComments: 'some' }))
.pipe(size())
.pipe(gulp.dest('./js/'));
});
gulp.task('lint', function () {
return gulp.src('./js/main.js')
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('jshint-stylish'));
});
// Rerun the task when a file changes
gulp.task('watch', function() {
gulp.watch('./js/*.js', ['scripts']);
gulp.watch('./scss/*.scss', ['styles']);
});
// The default task (called when you run `gulp` from cli)
gulp.task('default', ['styles', 'scripts']);