-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGulpfile.js
More file actions
51 lines (36 loc) · 1.29 KB
/
Copy pathGulpfile.js
File metadata and controls
51 lines (36 loc) · 1.29 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
var gulp = require('gulp');
var sass = sass = require('gulp-sass');
function swallowError (error) {
// If you want details of the error in the console
console.log(error.toString())
this.emit('end')
}
gulp.task('sass', function () {
gulp.src('./web/bundles/front/sass/master.scss')
.pipe(sass({sourceComments: 'map'}))
.on('error', swallowError)
.pipe(gulp.dest('./web/css/'));
});
var livereload = require('gulp-livereload');
gulp.task('watch', function () {
var onChange = function (event) {
console.log('File '+event.path+' has been '+event.type);
gulp.task('reload', ['installAssets', 'sass']);
// Tell LiveReload to reload the window
livereload.changed(event.path);
};
// Starts the server
livereload.listen();
gulp.watch('./src/*/Resources/public/sass/**/*.scss', ['sass'])
.on('change', onChange);
gulp.watch('./src/*/Resources/public/js/**/*.js', ['js'])
.on('change', onChange);
});
var exec = require('child_process').exec;
gulp.task('installAssets', function () {
exec('php app/console assets:install --symlink', logStdOutAndErr);
});
// Without this function exec() will not show any output
var logStdOutAndErr = function (err, stdout, stderr) {
console.log(stdout + stderr);
};