Laravel Gulp没有创建js文件夹
Laravel Gulp not creating js folder
我目前正在尝试让gulp在我的Laravel项目上运行。
我可以成功运行gulp在我的app.scss
我试图在测试咖啡脚本上运行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'.
还有其他人遇到过这个错误吗?
您没有指定咖啡脚本的名称,因此Elixir不知道它需要编译什么文件。您唯一需要做的就是在花括号之间指定脚本的名称,如下所示:
elixir(function(mix) {
mix.coffee('test.coffee');
});
还有一种叫做方法链接。这将允许您同时运行多个任务。如果您添加了Sass,您的代码应该看起来像这样:
elixir(function(mix) {
mix.sass('app.scss')
.coffee('test.coffee');
});
你可以在laravel文档中查看Elixir的更多信息。
相关文章:
- 如何将所有JS文件连接到一个文件夹中
- 如何将JS文件从其他文件夹链接到页面
- Yii2从js脚本的页面上添加来自供应商文件夹的图像、css、js文件
- 使用angularjs和node.js时的Web应用程序文件夹结构
- 当通过Node.js服务器访问时,Javascript文件在Chrome上工作,但从文件夹打开时不工作
- Gulp.js - 无法将生成的文件从一个文件夹复制到另一个文件夹
- Dropzone.js-上传文件夹结构和单个文件
- 使用JS限制响应式FileManager文件夹
- Dropzone.js没有将图像上传到文件夹
- 如何在node.js中组织文件夹结构
- 在Express.js应用程序的公用文件夹中创建一个文件
- 当.js和.html不在同一文件夹中时,如何在Aurelia中创建自定义元素
- 科尔多瓦使用SplashScreen插件在另一个文件夹中查找cordova_plugins.js
- JS脚本文件夹,而不是“;脚本”;在服务器ASP.NETMVC上部署后不可见
- 正在从本地windows存储文件夹读取js中的文件
- 更改sails.js中的配置文件夹结构
- getElementbyId返回空的外部js文件夹
- React JS和Meteor JS文件夹结构
- Laravel Gulp没有创建js文件夹
- Node和Express找不到我的js文件夹