-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
67 lines (57 loc) · 1.73 KB
/
gulpfile.js
File metadata and controls
67 lines (57 loc) · 1.73 KB
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
// Load all the required plugins.
var gulp = require('gulp'),
fs = require('fs'),
exec = require('gulp-exec'),
coffee = require('gulp-coffee'),
concat = require('gulp-concat'),
gutil = require('gulp-util'),
notify = require('gulp-notify'),
rename = require('gulp-rename'),
sass = require('gulp-ruby-sass'),
uglify = require('gulp-uglify'),
watch = require('gulp-watch');
var input = 'resources/assets/',
output = 'resources/theme/assets/';
var scripts = [
input + 'coffee/*.coffee'
];
var styles = [
input + 'scss/grapevine.scss'
];
gulp.task('styles', function() {
return gulp.src(styles)
.pipe(sass())
.pipe(rename('grapevine.dev.css'))
.pipe(gulp.dest(output + '/css'))
.pipe(sass({style: 'compressed'}))
.pipe(rename('grapevine.min.css'))
.pipe(gulp.dest(output + '/css'))
.pipe(notify({ message: 'SCSS files compiled.' }));
});
gulp.task('scripts', function() {
return gulp.src(scripts)
.pipe(coffee().on('error', gutil.log))
.pipe(concat('grapevine.dev.js'))
.pipe(gulp.dest(output + 'js'))
.pipe(rename('grapevine.min.js'))
.pipe(uglify({mangle: true}))
.pipe(gulp.dest(output + 'js'))
.pipe(notify({ message: 'Javascript files compiled.' }));
});
// Helper task for watching the scripts directories, and only the script directories
gulp.task('scripts-watch', function() {
gulp.run('scripts');
gulp.watch(input + 'coffee/**', function() {
gulp.run('scripts');
});
});
gulp.task('styles-watch', function() {
gulp.run('styles');
gulp.watch(input + 'scss/**', function() {
gulp.run('styles');
});
});
// When running gulp without any tasks, it'll watch the scripts, styles, and do artisan publishing.etc.
gulp.task('default' , function() {
gulp.start('scripts-watch', 'styles-watch');
});