Skip to content

Instantly share code, notes, and snippets.

@nWidart
Created October 5, 2015 20:41
Show Gist options
  • Save nWidart/33da54f27e7372cc4626 to your computer and use it in GitHub Desktop.
Save nWidart/33da54f27e7372cc4626 to your computer and use it in GitHub Desktop.
var gulp = require('gulp'),
shell = require('gulp-shell'),
gutil = require('gulp-util');
var publishAssets = function (evt) {
var changedFilePath = evt.path;
var splitFilePath = changedFilePath.split('/');
var moduleLocation = splitFilePath.indexOf('Modules') + 1;
var moduleName = splitFilePath[moduleLocation];
gutil.log('File ' + changedFilePath + ' changed, publishing ' + moduleName + ' module.');
gulp.src('').pipe(shell(['php artisan module:publish ' + moduleName + ' --market=pt']));
}
gulp.task('default', ['watch']);
gulp.task('watch', function () {
gulp.watch(['Modules/*/Assets/**/*'])
.on('change', function (evt) {
publishAssets(evt);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment