-
Notifications
You must be signed in to change notification settings - Fork 292
/
gulpfile.js
73 lines (66 loc) · 1.8 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
var gulp = require('gulp'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
notify = require('gulp-notify'),
plumber = require('gulp-plumber'),
concat = require('gulp-concat'),
livereload = require('gulp-livereload'),
lr = require('tiny-lr'),
server = lr();
function onError()
{
return console.error(arguments);
}
// CSS
gulp.task('styles', function() {
return gulp.src([
'resources/assets/scss/styles.scss',
'resources/assets/scss/ie.scss'
])
.pipe(plumber({
errorHandler: onError
}))
.pipe(sass())
.pipe(autoprefixer('last 2 version'))
.pipe(minifycss())
.pipe(gulp.dest('public/assets/css'))
.pipe(livereload(server))
.pipe(notify({ message: 'Styles task complete' }));
});
gulp.task('copy-scripts', function() {
gulp.src('resources/assets/js/libs/ie_font.js')
.pipe(gulp.dest('public/assets/js'));
});
// Minify, rename, and move
gulp.task('scripts', ['copy-scripts'], function() {
return gulp.src([
'resources/assets/js/libs/jquery.js',
'resources/assets/js/libs/run_prettify.js',
'resources/assets/js/libs/fastclick.js',
'resources/assets/js/plugins.js',
'resources/assets/js/application.js'
])
.pipe(concat('bundle.js'))
.pipe(uglify())
.pipe(gulp.dest('public/assets/js'))
.pipe(livereload(server))
.pipe(notify({ message: 'Scripts task complete' }));
});
// Default
gulp.task('default', function() {
gulp.start('styles', 'scripts');
});
// Watch
gulp.task('watch', function() {
// port 35729 is LiveReload
server.listen(35729, function (err) {
if (err) {
return console.error(err);
}
gulp.watch('resources/assets/scss/**/*.scss', ['styles']);
gulp.watch('resources/assets/js/**/*.js', ['scripts']);
});
});