laravel5環境下,如何用elixir+browserSync實現php頁面即時預覽?
var gulp = require('gulp'), browserSync = require('browser-sync').create(), less = require('gulp-less');var elixir = require('laravel-elixir');//elixir.config.sourcemaps = false;var config = { name : 'baseblue', version : '2.0.0', proxy : 'localhost:8888', jsDir : 'public/js/', cssDir : 'public/css/', minDir : 'public/min', viewDir : 'resources/views/'}gulp.task('server', function() { browserSync.init({ proxy: config.proxy,//Proxy 位址 notify: false, open: true }); gulp.watch(['resources/assets/less/test.less'],['testless']); gulp.watch([ config.viewDir+'**/*.blade.php', config.jsDir+'**/*.js', config.cssDir+'**/*.css' ]).on("change", browserSync.reload);});gulp.task('testless',function(){ return elixir(function(mix) { mix.less('test.less'); });});
為什麼elixir不能在gulp task的函數中使用?
回複內容:
laravel5環境下,如何用elixir+browserSync實現php頁面即時預覽?
var gulp = require('gulp'), browserSync = require('browser-sync').create(), less = require('gulp-less');var elixir = require('laravel-elixir');//elixir.config.sourcemaps = false;var config = { name : 'baseblue', version : '2.0.0', proxy : 'localhost:8888', jsDir : 'public/js/', cssDir : 'public/css/', minDir : 'public/min', viewDir : 'resources/views/'}gulp.task('server', function() { browserSync.init({ proxy: config.proxy,//Proxy 位址 notify: false, open: true }); gulp.watch(['resources/assets/less/test.less'],['testless']); gulp.watch([ config.viewDir+'**/*.blade.php', config.jsDir+'**/*.js', config.cssDir+'**/*.css' ]).on("change", browserSync.reload);});gulp.task('testless',function(){ return elixir(function(mix) { mix.less('test.less'); });});
為什麼elixir不能在gulp task的函數中使用?
laravel內建browserSync
謝謝!終於實現了,根據elixir版本選擇不同安裝對應的laravel-elixir-browsersync外掛程式。