shaho
(shaho)
June 18, 2022, 7:56am
1
I have my site.css
in my web/css/
which i declared here
namespace frontend\assets;
use yii\web\AssetBundle;
class AppAsset extends AssetBundle
{
public $basePath = '@webroot';
public $baseUrl = '@web';
public $css = [
'css/site.min.css'
];
}
How do i get AssetBundle
to copy it into the assets folder to make it look like this
<link href="/frontend/web/assets/2edj2hj2jk/css/site.css" rel="stylesheet">
instead of this?
<link href="/frontend/web/css/site.css" rel="stylesheet">
or is there another way to achieve this?
evstevemd
(Stefano Mtangoo)
June 18, 2022, 10:03am
2
@webroot /css is publicly accessible and will not be copied. I wonder why you want anything to be copied. If you get error check css file names do not match!
shaho
(shaho)
June 18, 2022, 10:51am
3
Thanks for replying. I’m using this plugin to push my assets to aws s3
https://github.com/white43/yii2-cloud-asset-manager
Just thought it might be easier to have all static files on S3 and not have to upload it manually.
evstevemd
(Stefano Mtangoo)
June 20, 2022, 6:24am
4
It should have managed everything for you if you followed instructions.
What problem are you facing with the extension?
shaho
(shaho)
June 21, 2022, 11:23am
5
it manages my assets in modules, but not sure how to get it to manage my assets in web/images
, web/js
and web/
css`.
all my assets in modules are pushed to S3 just fine. except the ones in the directories i just mentioned.
this is what i have in my assetManager
'assetManager' => [
'forceCopy' => (YII_ENV == 'dev') ? true : false,
'appendTimestamp' => (YII_ENV == 'dev') ? false : true,
'bundles' => [
'yii\web\YiiAsset' => [
'sourcePath' => '@app/web/js',
'js' => (YII_ENV == 'dev') ? ['site.js'] : ['site.min.js'],
'jsOptions' => ['defer' => true],
'publishOptions' => [
'only' => (YII_ENV == 'dev') ? ['site.js'] : ['site.min.js']
]
],
'yii\widgets\ActiveFormAsset' => false,
'yii\validators\ValidationAsset' => false,
//override jQuery
'yii\web\JqueryAsset' => [
'js' => ['https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js'],
'jsOptions' => ['type' => 'text/javascript'],
],
'yii\bootstrap4\BootstrapAsset' => [
'sourcePath' => null, // do not publish the bundle
'css' => [
'https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css'
],
],
'yii\bootstrap4\BootstrapPluginAsset' => [
'sourcePath' => null, // do not publish the bundle
'js' => [
'https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js'
],
'jsOptions' => ['defer' => true],
],
],
],
evstevemd
(Stefano Mtangoo)
June 21, 2022, 1:29pm
6
Just put them in non public DIR and do the same way you do in modules
I would not advise you to do multiple assets managements like that!