Correctly locating asset file with asset library

南楼画角 提交于 2020-02-25 08:46:05

问题


I'm using the asset library that comes with pyrocms for my cms and I have a set up like this for my assets. I am trying to figure out with the paths and namespacing how I can access the bootstrap.css file correctly with the documentation.

http://docs.pyrocms.com/2.1/manual/developers/tools/assets

I have updated my asset.php configuration file to look like this:

$config['asset_paths'] = array(
    'core' => 'assets/',
    'globals' => 'assets/globals/'
);

This is the line I have set up in my template page to try and retrieve the bootstrap file:

<?php Asset::css('globals::bootstrap/css/bootstrap.min.css'); ?>

This is my file directory:

/root
    /assets
        /globals
            /bootstrap
                /css
                    bootstrap.css

It is saying the following error message.

Found no files matching assets/globals/css/bootstrap/css/bootstrap.min.css

Any ideas on what I good fix would be for this?


回答1:


I've never used the library in question, but judging on your post it appears that the library automatically checks for a css folder within the designated asset_path.

I would create a new asset path called bootstrap:

'bootstrap' => 'assets/globals/bootstrap/'

and add the CSS file as such:

Asset::css('bootstrap::bootstrap.min.css');



来源:https://stackoverflow.com/questions/16638002/correctly-locating-asset-file-with-asset-library

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!