curious_pawn
curious_pawn

Reputation: 334

How to prevent load default css in yii?

I want to apply custom Style in my application. Is there any way to prevent loading of default style sheet files. Because whenever i manually delete style sheet files from its recreated every time. Any help will be useful. Thanks in advance.

Upvotes: 0

Views: 486

Answers (1)

Jagjot
Jagjot

Reputation: 6136

In Yii there is one property of CClientScript class called ScriptMap. You can define which files(css/js) files not to load in it. An example of using scriptMap is :-

You can add this code on the top of your view file.

If you don't want the file 'abc.css' which is by default loaded in you page should be disabled, then you can disable it like this

$cs = Yii::app()->clientScript;
$cs->scriptMap = array(
    'abc.css' => false
);

Now if you want that all CSS or JS files should be disabled then you can also use wildcards like

$cs->scriptMap = array(
    '*.js' => false,
    '*.css' => false,
);

This will disable all the CSS and JS files which are loaded by default.

UPDATE 1:

You can also put this code in your main layout, so files won't be loaded in any view.

Upvotes: 1

Related Questions