【问题标题】:Laravel 4: codesleeve/asset-pipeline, giving me blank output for js and cssLaravel 4:codesleeve/asset-pipeline,给我 js 和 css 的空白输出
【发布时间】: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


    【解决方案1】:

    这可能是几件事,但我会从你的 css/javascript 文件的样子开始(特别是你正在使用的清单文件)。

    例如,如果你在做require_tree .,请注意这个目录是相对于清单文件本身的。

    【讨论】:

      猜你喜欢
      • 2013-12-31
      • 1970-01-01
      • 1970-01-01
      • 2023-04-08
      • 1970-01-01
      • 1970-01-01
      • 2021-10-09
      • 2018-04-04
      • 1970-01-01
      相关资源
      最近更新 更多