Answer the question
In order to leave comments, you need to log in
What is asset in Yii2? What are they needed for?
I started studying this frame, before I only made my own. Though kill, I do not understand the purpose of this stray. On the fingers, can anyone explain in a simple way what it is and what it is for? It seems to have read that this is to automate the connection of css, js, etc. But isn't it easier to prescribe them manually than to fence the whole class? Still I don't understand something, I'm leaning towards it.
Answer the question
In order to leave comments, you need to log in
assets - (assets)
In this directory, Yii generates compact styles and js.
Regular cleaning of this directory solves unknown problems.
> But isn't it easier to prescribe them manually than to fence the whole class? Still I don't understand something, I'm leaning towards it.
In complex and large projects, assets simplify dependency management and minification. VERY easy.
In addition, to connect any file, assets are also needed to control dependencies that are automatically loaded, for example, you connect some JQuery plugin and don’t know if JQuery itself has already been connected, you write it as a dependency and it will automatically be connected, if not connected.
You can also minify styles with regular Yii2 tools only if they are in assets
Well, in general, it's understandable. For my modest purposes, it is not necessary. Thanks to all.
Also, the protected folder in yii is prohibited from external access, and just extensions and modules are placed in it, and at the same time, the framework takes css and js files from it to the assets folder, otherwise, when installing the module, you would have to move them manually
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question