Darrell Brogdon
Darrell Brogdon

Reputation: 6973

Prevent Yii from loading JS out of assets

Is there a way to configure Yii such that it will no longer load any Javascript out of the Assets folder?

Upvotes: 2

Views: 672

Answers (2)

apoq
apoq

Reputation: 1454

You should consult the manual for a detailed description of the assetManager options

I think you can try following option in your config/main.php

'components' => array(
   'assetManager' => array(
     'linkAssets' => true,
   ),
),

This will make asset files symbolic links to your original js/css sources. See linkAssets for more details on it.

If your PHP<5.3, or the OS it's running on doesn't support symbolic links, you won't be able to use 'linkAssets' option, in this case you can try:

'components' => array(
   'assetManager' => array(
     'forceCopy' => true,
   ),
),

This should update asset folder on every request. These two options are usually used during development process (btw, you can't use both) and should be removed from production.

PS: if you're sure that you haven't explicitly enabled ckeditor somewhere in your code and you're confident about your assetmanager calls throughout the code, check your layout and page for widgets that require this CKeditor, as Yii can't preload 'stuff' just randomly, it can be triggered by some preloaded component/extension or yii widget.

Upvotes: 0

Imre L
Imre L

Reputation: 6249

Make your own AssetManager or extend current

protected/components/DummyAssetManager.php:

class DummyAssetManager extends CApplicationComponent {
    public function publish(){}
}

add into components array in protected/config/main.php:

    'assetManager'=>array(
        'class'=>'DummyAssetManager',
    ),

Upvotes: 4

Related Questions