A
A
asmerdev2014-10-01 08:55:02
Yii
asmerdev, 2014-10-01 08:55:02

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

6 answer(s)
I
Ilya, 2014-10-01
@hrhr99

assets - (assets)
In this directory, Yii generates compact styles and js.
Regular cleaning of this directory solves unknown problems.

V
Vit, 2014-10-01
@fornit1917

> 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.

A
Alexey Likhachev, 2014-10-01
@Playbot

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

A
asmerdev, 2014-10-01
@asmerdev

Well, in general, it's understandable. For my modest purposes, it is not necessary. Thanks to all.

E
Evgeny Bukharev, 2014-10-22
@evgenybuckharev

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

P
phpnt, 2015-03-06
@phpnt

Adding CSS, JS, jQuery and more to Yii...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question