2015-10-14 84 views
0

我目前正試圖讓我的Laravel項目運行gulp。Laravel Gulp不創建js文件夾

我可以成功地在我的app.scss運行一飲而盡

我想運行一個測試腳本咖啡一飲而盡,咖啡腳本中找到資源>資產>咖啡> test.coffee

這裏是我的gulpfile.js

var elixir = require('laravel-elixir'); 

/* 
|-------------------------------------------------------------------------- 
| 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 Sass 
| file for our application, as well as publishing vendor resources. 
| 
*/ 

elixir(function(mix) { 
    mix.sass('app.scss'); 
    mix.coffee(); 
}); 

當我運行gulp我得到這個錯誤。

fetching Sass Source Files... 
    - resources/assets/sass/app.scss 


Saving To... 
    - public/css/app.css 

[23:08:58] Finished 'default' after 313 ms 
[23:08:58] gulp-notify: [Laravel Elixir] Sass Compiled! 
[23:08:58] Finished 'sass' after 403 ms 
[23:08:58] Starting 'coffee'... 
[23:08:58] 'coffee' errored after 311 μs 
[23:08:58] TypeError: Cannot call method 'indexOf' of undefined 
    at prefixOne (/home/pocockn/projects/dev.todoparrot.com/node_modules/laravel-elixir/GulpPaths.js:104:18) 
    at GulpPaths.prefix (/home/pocockn/projects/dev.todoparrot.com/node_modules/laravel-elixir/GulpPaths.js:124:12) 
    at GulpPaths.src (/home/pocockn/projects/dev.todoparrot.com/node_modules/laravel-elixir/GulpPaths.js:24:16) 
    at prepGulpPaths (/home/pocockn/projects/dev.todoparrot.com/node_modules/laravel-elixir/tasks/coffee.js:55:10) 
    at null.definition (/home/pocockn/projects/dev.todoparrot.com/node_modules/laravel-elixir/tasks/coffee.js:21:21) 
    at Task.run (/home/pocockn/projects/dev.todoparrot.com/node_modules/laravel-elixir/Task.js:96:17) 
    at Gulp.<anonymous> (/home/pocockn/projects/dev.todoparrot.com/node_modules/laravel-elixir/index.js:94:52) 
    at module.exports (/home/pocockn/projects/dev.todoparrot.com/node_modules/orchestrator/lib/runTask.js:34:7) 
    at Gulp.Orchestrator._runTask (/home/pocockn/projects/dev.todoparrot.com/node_modules/orchestrator/index.js:273:3) 
    at Gulp.Orchestrator._runStep (/home/pocockn/projects/dev.todoparrot.com/node_modules/orchestrator/index.js:214:10) 
[23:08:58] Error in plugin 'run-sequence' 
Message: 
    An error occured in task 'coffee'. 

是否有其他人遇到此錯誤?

回答

2

您沒有指定咖啡腳本的名稱,所以Elixir不知道需要編譯哪個文件。你需要做的唯一事情就是指定大括號像這樣的腳本的名稱:

elixir(function(mix) { 
    mix.coffee('test.coffee'); 
}); 

也有一些所謂的方法鏈接。這將允許您一次運行多個任務。如果你把你的無禮,你的代碼應該是這個樣子:

elixir(function(mix) { 
    mix.sass('app.scss') 
    .coffee('test.coffee'); 
}); 

您可以隨時檢查laravel文檔有關藥劑here的更多信息。