繁体   English   中英

Laravel Gulp不创建js文件夹

[英]Laravel Gulp not creating js folder

我目前正在尝试让gulp在我的Laravel项目上运行。

我可以在我的app.scss上成功运行gulp

我试图在测试咖啡脚本上运行gulp,在资源>资产>咖啡> 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'.

还有其他人遇到此错误吗?

您没有指定coffee脚本的名称,因此Elixir不知道需要编译什么文件。 您唯一需要做的就是在大括号之间指定脚本名称,如下所示:

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

还有一种称为方法链接的方法 这将允许您一次运行多个任务。 如果添加Sass,则代码应如下所示:

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

您可以随时检查laravel文档有关药剂的详细信息在这里

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM