Last active
January 9, 2016 03:29
-
-
Save shanecp/a5f72d5643f714da20a0 to your computer and use it in GitHub Desktop.
Laravel 5 Elixir with LiveReload custom task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// require the file | |
require('./gulp_tasks/watch'); | |
// Call the new task in Laravel Elixir file | |
elixir(function(mix)) { | |
mix.watch(); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'); | |
var _ = require('underscore'); | |
var config = require('laravel-elixir').config; | |
var inSequence = require('run-sequence'); | |
var livereload = require('gulp-livereload'); | |
var elixir = require('laravel-elixir'); | |
var srcPaths; | |
var tasksToRun; | |
elixir.extend('watch', function () { | |
gulp.task('watch', function() { | |
livereload.listen(); | |
srcPaths = config.watchers.default; | |
tasksToRun = _.intersection(config.tasks, _.keys(srcPaths).concat('publish')); | |
inSequence.apply(this, tasksToRun.concat('watch-assets')); | |
gulp.on('stop', function(){ | |
livereload.changed("Application"); | |
}); | |
}); | |
gulp.task('watch-assets', function() { | |
for (task in srcPaths) { | |
gulp.watch(srcPaths[task], [task]); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This won't be maintained anymore. Switch to
browserSync
with Laravel 5 instead.