During development and depending on your setup you may need to use the options forceCopy
or
linkAssets
of the asset manager to work around possible file-system and permission issues.
During development and depending on your setup you may need to use the options forceCopy
or
linkAssets
of the asset manager to work around possible file-system and permission issues.
A Yii Framework 2 component for using assets in different environments (Local/CDNs)
If you don't want to use any of the AJAX features of CListView and thus want to prevent that it publishes any of its asset files, you can extend it and create a sub class like this:
If you coming to Yii with experience with Zend Framework for example, most likely you get used to
Zend_Registry::get('paramName');
Zend_Registry::set('paramName');
Alternatively, inline assets (JS/CSS) can be registered at runtime from within the View
.
For example you can clearly simulate the ajaxLink feature using a inline javascript. Its however recommended if you can merge where possible, client code (JS/CSS) into separate JS/CSS files and loaded through the AssetBundle. Note there is no more need of a CClientScript anymore:
When you develop a widget, you could need one image that is in the assets folder, you can use it simply within a css. You can load a css or javascript script doing this:
Yii::app()->getClientScript()->registerCssFile($filename);
By default, Yii 2.0 chooses to use the non-minified version of Jquery and Bootstrap files (CSS and JS). However, there's a simple way to indicate Yii to use the minified version.
If you like the things to be short and clear, then you can skip right to a short summary of instructions at the end of this article.
If you're using a lot of bower and npm assets with Yii 2.0 you might encounter long running composer update
tasks.
Many newcomers to Yii ask about the assets/
directory found under the webroot, and this article means to explain why it's there and how to work with it.