Skip to content

Enqueue only the assets (.css and .js) from the the components used on a specific page #362

Answered by domtra
obritoluis asked this question in Q&A
Discussion options

You must be logged in to vote

hi @obritoluis ,
thanks for the question. In versions of Flynt before v1.0.0, we actually enqueued assets only, when a component was on a page. We decided to change our loading strategy, however, because it made the build process and the enqueuing more complex than it needed to be.

We also discovered, that despite having http/2 enabled, the page speed with one big js and css bundle was significantly faster, than with single files per component. This finally made us change the default way of how to load assets in Flynt.

The fastest way to achieve what you are trying to do, will probably not to go the WordPress way, and enqueue separate assets for each component, but to make use of webpacks…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@obritoluis
Comment options

Answer selected by steffenbew
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants