Open hello-omny opened 7 years ago
if you use assets for grouping JS/CSS files as well as publishing other content, you should probably separate the other content from JS/CSS into a separate AssetBundle to have them published even if CSS/JS goes through the minified way. The MainPageAsset
does not get published as normal with the asset grouping approach so files that are not JS or CSS are not available.
Not sure it is possible to achieve what you are asking for. Its better to separate assets imo.
Thx for reply!
I can't separate images from css, because i need link it in CSS like this:
.play-icon {
background-img: url (../img/play.gif);
}
This code work fine for me.
The MainPageAsset does not get published as normal with the asset grouping approach so files that are not JS or CSS are not available.
Bundle is published ok. I had tried it just now, asset folder have been cleared before it. Images and other files have been copied to right place, scripts and styles is there too. But path and url to there location does not stored.
Hi @hello-omny, you can use something like this:
$directoryAsset = Yii::$app->assetManager->getPublishedUrl('@vendor/almasaeed2010/adminlte/dist');
or [AssetManager::getAssetUrl()](https://www.yiiframework.com/doc/api/2.0/yii-web-assetmanager#getAssetUrl()-detail)
What steps will reproduce the problem?
Create asset bundle, resource files must be stored not in @webroot, for example something like this
@app/themes/night/assets
.In my case i have:
My asset bundle:
In view i get base url of image:
On this step
$baseUrl = /assets/2a669ca1
it Isn't null, that's ok. I use it for build path to img:I use guide for grouping asset bundles, have been build that i needed, all worked perfect, but!
What is the expected result?
I expecting
$assetPrefix = /assets/2a669ca1
.What do you get instead?
I have got
$assetPrefix = null
.Additional info
Images, styles and scripts of my bundle and other have been created normally at
@web/assets/...
.