G
G
Gip2019-06-21 04:17:41
Yii
Gip, 2019-06-21 04:17:41

How to pack vendor resources in yii2?

Good afternoon!
I use webpack + laravel mix in Yii2. Everything turns out great and perfect for my resources. But what's the point if the components publish their own in all sorts of ways and anyway, each request stretches a bunch of motley css and js that are not minimized, not glued, and in general.
Is there any solution to collect all this in one place? In some vendor.css and vendor.js? The option to redefine each component and rewrite how it publishes resources is tempting, but looking at what's going on for some, it makes your hair stand on end. And the amount of work will be comparable to the development of the application itself.
Has anyone solved a similar problem or am I worried in vain?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
Kirill Kudryavtsev, 2019-06-21
@Deissh

Webpack itself minifies the code and, if possible, styles (if there is a plugin). In the webpack configuration, we specify the destination folder and entypoints. If necessary, you can also do tree shaking with splitting into bundles and a separately included vendors file.
webpack docs

G
Gip, 2019-06-22
@Giperoglif

I call Alexander Makarov

E
Egor Mokeev, 2019-06-24
@zetamen

Maybe yii2-minify-view will suit you .
I didn’t find anything more or less manageable, so I collect bundles manually using gulp. Component resources can be disabled via config.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question