Is there a way to include inline js and css code directly from .js and .css files in twig?

I’m working on a huge website with a lot of sections and landing pages, and we’re calling all the css and js from files (which are cached in our CDN), but now we want to test inlining all the css and javascript code needed in landing pages to check if that improves our site speed.
So instead of calling the files itself, is there a way to render the files inline in twig?

Edit: The css/js files are minified and we are using the best approach considering cache and our CDN… but in this case, the landing pages where we want to test it, the user is not supposed to navigate to any other page – that’s why we want to inline everything and check if that improves some of the site speed metrics for those pages in particular.

Thanks

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *