Skip to content

Instantly share code, notes, and snippets.

@shouhei
Last active August 29, 2015 14:23
Show Gist options
  • Select an option

  • Save shouhei/d98169ae7314a275e234 to your computer and use it in GitHub Desktop.

Select an option

Save shouhei/d98169ae7314a275e234 to your computer and use it in GitHub Desktop.
composer dump-autoload を自動で実行するやーつ
var elixir = require('laravel-elixir');
var gulp = require('gulp');
// npm install --save-dev gulp-shell
var shell = require('gulp-shell');
/*
|--------------------------------------------------------------------------
| Elixir Asset Management
|--------------------------------------------------------------------------
|
| Elixir provides a clean, fluent API for defining some basic Gulp tasks
| for your Laravel application. By default, we are compiling the Less
| file for our application, as well as publishing vendor resources.
|
*/
elixir(function(mix) {
mix.less('app.less');
});
gulp.task('watch',function(){
gulp.watch(['*.php'],function(event){
if(event.type === "added"){
console.log(event.path+' added');
shell('composer dump-autoload');
}else if( event.type === 'deleted'){
console.log(event.path+' deleted');
shell('composer dump-autoload');
}
});
// routes.phpが変更されたら php artisan route:cacheを実行
gulp.watch(['**/routes.php'], function(event){
console.log('routes.phpに変更が有りました');
shell('php artisan route:cache');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment