Elixir版本控制公共路径 [英] Elixir versioning public path
问题描述
我正在尝试将Elixir的version()方法与我的公共"文件夹设为public_html(而不是默认的公共"方法)一起使用.
I'm trying to use Elixir's version() method with my 'public' folder being public_html (instead of the default 'public' method).
我对我的css文件进行版本控制,该文件会生成一个带有public_html清单的清单的构建文件夹
I version my css file, which produces a build folder with the manifest inside public_html
elixir.config.cssOutput = 'public_html/css';
elixir.config.jsOutput = 'public_html/js';
elixir(function(mix) {
mix.styles([
'vendor/normalize.css',
'app.css'
], null, 'public_html/css');
mix.version('public_html/css/all.css');
});
在刀片模板中,我使用
<link href="{{ elixir("css/all.css") }}" rel="stylesheet">
问题是在'public/build'文件夹中搜索的长生不老药功能.我该如何更改,以便它搜索public_html文件夹?
Problem is the elixir function searches in 'public/build' folder. How can I change this so it searches public_html folder?
提前谢谢
推荐答案
您忘了覆盖gulpfile.js
文件中的publicDir文件夹,这将build
文件夹指向elixir用于确定正确位置的正确位置.版本哈希.
You forgot to overwrite your publicDir folder in the gulpfile.js
file, this points the build
folder to the correct location which is used by elixir to determine the version hash.
elixir.config.publicDir = 'public_html';
在您必须覆盖Laravel中的public_path之后,Laravel 5的推荐方法是转到公用文件夹中的index.php
:
After you did that you must overwrite your public_path in Laravel, the recommended way for Laravel 5 is to go to the index.php
in your public folder:
在底下
$app = require_once __DIR__.'/../bootstrap/app.php';
添加
// set the public path to this directory
$app->bind('path.public', function() {
return __DIR__;
});
这篇关于Elixir版本控制公共路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!