D
D
Dmitry Kim2015-11-18 14:13:11
Yii
Dmitry Kim, 2015-11-18 14:13:11

How to set path for Asset in Yii2?

Is it possible in yii2 to set the path for copying resources?
(Yii2 advanced, just in case)
In general, I protected-domain-dir/assets/less/have a styles.less.
It contains something like this:

@import "../../../vendor/bower-asset/bootstrap/less/bootstrap.less";

That is, when building, it imports bootstrap *.lessfiles (from vendor/bower-asset/bootstrap/less), changes variables, and then saves to protected-domain-dir/assets/css/styles.cssa -file (minified with winless), which is then published via AppAsset.
The obvious catch is that the glyphicons font files are not copied from the vendor/bower-asset/bootstrap/fonts folder to the styles file folder and naturally don't work.
Is it possible to somehow tell yii that this particular asset needs to be copied to the folder @webroot/css/styles.css, and not to, @webroot/assets/хеш/styles.cssand put the font files in the same place?
PS --------------------
As a result, if the AppAsset file contains the following code:
class AppAsset extends AssetBundle
    {
        public $sourcePath = '@app/assets/css';
        public $css = [
            'styles.css',
        ];
}

Then on the web it will be like this:
domain.com/assets/хеш/styles.css
And I need this:
domain.com/css/styles.css

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2015-11-18
@R0dger

Look here -
www.yiiframework.com/doc-2.0/yii-web-assetbundle.h...
stackoverflow.com/questions/25686904/how-do-i-mana...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question