YiiBooster icon indicating copy to clipboard operation
YiiBooster copied to clipboard

Load the CSS/JS at specified moment

Open IngwiePhoenix opened this issue 10 years ago • 2 comments

Hey.

I have a bootstrap based app already together with a custom theme, and now I wanted to ad dBooster to it to have an easier access to widgets. But due to it's urge to always register on pre-load, I need to find a way to delay this load.

Currently I am using a custom renderScripts method which is called int he main viewfile. How can I now add YiiBooster to that chain of CSS/JS inserts, so it inserts itself after my resources?

Kind regards, Ingwie

IngwiePhoenix avatar Jan 16 '15 11:01 IngwiePhoenix

'booster' => [
            'class' => 'booster.components.Booster', // assuming you extracted bootstrap under extensions
            'responsiveCss' => true,
            'coreCss' => true,
            'bootstrapCss' => false,
            'yiiCss' => true,
            'enableJS' => false,
            'enableBootboxJS' => true,
            'enableNotifierJS' => true,
            'enablePopover' => false,
            'enableTooltip' => false,
            //'debug' => true
        ],

you can enable and disable whatever you want ... this is just a sample from one of our projects ... using custom bootstrap theme

amrbedair avatar Jan 16 '15 12:01 amrbedair

I can, yes. But the issue is when it is being inserted. Even if I let a single JS file be enabled, it -will- be inserted before my scripts due to being called way earlier. I need a solution to disable the pre-loading and choose when exactly to load the CSS and JS stuff so I can load it from within my procedure. But looking into the code, I could not see anything. So appearently i now must make my own extension and re-load it before YiiBooster… Or is there still a way to get this behaviour, without me making a new component?

Good thing my code is open sourced: Config: http://git.ingwie.me/ingwie/bird3/blob/master/protected/config/main.php#L67 http://git.ingwie.me/ingwie/bird3/blob/master/protected/config/main.php#L67 Script loader: http://git.ingwie.me/ingwie/bird3/blob/master/protected/components/Controller.php#L129 http://git.ingwie.me/ingwie/bird3/blob/master/protected/components/Controller.php#L129 When the script loader is called: http://git.ingwie.me/ingwie/bird3/blob/master/themes/dragonsinn/views/layouts/main.php#L9 http://git.ingwie.me/ingwie/bird3/blob/master/themes/dragonsinn/views/layouts/main.php#L9

Maybe this helps you understand what and why i am doing this.

Am 16.01.2015 um 13:40 schrieb Amr Bedair [email protected]:

'booster' => [ 'class' => 'booster.components.Booster', // assuming you extracted bootstrap under extensions 'responsiveCss' => true, 'coreCss' => true, 'bootstrapCss' => false, 'yiiCss' => true, 'enableJS' => false, 'enableBootboxJS' => true, 'enableNotifierJS' => true, 'enablePopover' => false, 'enableTooltip' => false, //'debug' => true ], you can enable and disable whatever you want

— Reply to this email directly or view it on GitHub https://github.com/clevertech/YiiBooster/issues/997#issuecomment-70248360.

IngwiePhoenix avatar Jan 16 '15 17:01 IngwiePhoenix