-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGulpfile.js
64 lines (57 loc) · 1.69 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
// Gulpfile
var gulp = require('gulp');
var sass = require('gulp-ruby-sass');
var run = require('gulp-run');
var notify = require('gulp-notify');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var livereload = require('gulp-livereload');
var browserify = require('gulp-browserify');
var path = {
app: 'app',
config: 'config',
resources: 'resources',
vendor: 'vendor/sharenjoy/cmsharenjoy/src',
root: 'public'
};
gulp.task('css', function()
{
gulp.src(path.root + '/css/scss/main.scss')
.pipe(sass({style: 'compressed'}))
.on('error', notify.onError({
title: "Error running something",
message: "Error: <%= error.message %>"
}))
.pipe(gulp.dest(path.root + '/css'))
.pipe(livereload());
});
gulp.task('js', function()
{
gulp.src(path.root + '/js/main.js')
.pipe(browserify({debug: true}))
.on('error', notify.onError({
title: "Error running something",
message: "Error: <%= error.message %>"
}))
.pipe(rename(path.root + '/js/bundle.js'))
.pipe(gulp.dest('./'))
.pipe(livereload());
});
gulp.task('compress', function()
{
gulp.src(path.root + '/js/bundle.js')
.pipe(uglify())
.pipe(rename(path.root + '/js/min.js'))
.pipe(gulp.dest('./'));
});
gulp.task('watch', function()
{
gulp.watch([path.app + '/**/*.php',
path.config + '/**/*.php',
path.resources + '/**/*.php',
path.vendor + '/**/*.php'
]);
gulp.watch(path.root + '/js/**/*.js', ['js']);
gulp.watch(path.root + '/css/scss/**/*.scss', ['css']);
});
gulp.task('default', ['watch']);