【发布时间】:2013-08-24 19:45:37
【问题描述】:
所以我正在 laravel 4 中构建一个基于主题的网站。这已经有效。主题在配置文件中指定。
我正在尝试使用 codeleeve 的 asset-pipeline 从 /app/themes/some-theme-name/assets/... 下的主题文件夹中访问资产文件。
显然不在公用文件夹下。
我已清空管道配置中指定的默认路径,并将此代码添加到我设置的侦听器文件中。
Event::listen('assets.register.paths', function($paths) {
$paths->add('app/themes/'.Config::get('custom.theme').'/assets/js' , 'javascripts');
$paths->add('app/themes/'.Config::get('custom.theme').'/assets/css', 'stylesheets');
$paths->add('app/themes/'.Config::get('custom.theme').'/assets/fonts', 'other');
$paths->add('app/themes/'.Config::get('custom.theme').'/assets/images', 'other');
});
我知道这是可行的,因为如果您尝试请求图像,请说 /assets/test.jpg 我会得到图像。
但如果我尝试访问 /assets/test.css,我会得到空白输出,即使文件中有 css 代码。任何 .js 文件都一样。
对可能出现的问题有任何想法吗?
【问题讨论】:
标签: php laravel asset-pipeline