Laravel 5 Elixir css/js在CLI中运行'gulp'后未进入public/目录 [英] Laravel 5 Elixir css/js not coming into public/ directory after running 'gulp' in CLI
问题描述
我阅读了Laravel 5的新Elixir可用的文档.
I read the documentation available for Laravel 5's new Elixir.
我已经编写了这段代码并多次运行gulp,但是,已编译/最小化的CSS和JS不会出现:
I have written this code and run gulp multiple times, however, the compiled/minified css and js are not coming in:
var elixir = require('laravel-elixir');
elixir(function(mix) {
mix
.styles([
"resources/assets/components/bootstrap/dist/css/bootstrap.css"
])
.scripts([
"resources/assets/components/jquery/dist/jquery.js"
])
.version('css/app.css');
});
我已经在CLI中运行了npm install
和gulp
,我得到了以下输出(看起来很正常):
I've run npm install
and gulp
in the CLI and I get this output (which seems normal):
[05:15:58] Starting 'default'...
[05:15:58] Starting 'styles'...
[05:16:00] Finished 'default' after 1.32 s
[05:16:00] Finished 'styles' after 1.32 s
[05:16:00] Starting 'scripts'...
[05:16:00] Finished 'scripts' after 456 ms
[05:16:00] Starting 'version'...
[05:16:00] Finished 'version' after 2.6 ms
vagrant@homestead:~/Code/fixer$
这是什么问题?我也看过《 Laracast》,看来我做得很好.
What's the problem here? I also watched the Laracast and it seems I'm doing everything properly.
鉴于这是新事物,很难找到一个好的答案.
It's difficult to find a good answer given this is new.
推荐答案
Elixir将假定您要连接的样式表和脚本位于public/目录中.要覆盖它,请设置基本目录.
Elixir will assume that the stylesheets and scripts that you're concatenating are located in the public/ directory. To override that, set the base directory.
elixir(function(mix) {
mix
.styles([
"components/bootstrap/dist/css/bootstrap.css"
], "resources/assets")
.scripts([
"components/jquery/dist/jquery.js"
], "resources/assets")
.version('css/app.css');
});
(但也请记住,您正在尝试在每个块中串联一个文件……也许只是为了您的代码段.)
(But also remember that you're trying to concatenate one file in each of those blocks... Maybe that was just for your code snippet.)
这篇关于Laravel 5 Elixir css/js在CLI中运行'gulp'后未进入public/目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!