cancel
Showing results for 
Search instead for 
Did you mean: 

CSS and JS loading WAY too slow!!

SOLVED

CSS and JS loading WAY too slow!!

Just installed a brand new Magento 2.1 with a custom theme slightly edited from the Luma theme. It's up and running but extremely slow to load the css and js before the page renders. If someone could take a look and give some feedback would be huge! 

Website is http://www.aesmark.com/shop

Thanks so much!

 

6 REPLIES

Re: CSS and JS loading WAY too slow!!

Hello,

 

 

Try to go to:

Stores -> Configuration ->Advanced -> Developer

 

and enable:

Merge JavaScript Files -yes

Enable JavaScript Bundling - yes

 

You will need to delete static files:

rm -rf pub/static/frontend/ pub/static/adminhtml/ pub/static/_requirejs/

 

then create new static files:

bin/magento setup:static-content:deploy

 

 

PS: I don't know if it works for .less files like

http://www.aesmark.com/shop/pub/static/version1487878321/frontend/epicenter/epitheme/en_US/css/sourc...

 

Stanislav

 

 

Re: CSS and JS loading WAY too slow!!

I forgot to say that you should set Magento to production mode

by adding into .htaccess file:

SetEnv MAGE_MODE production

 

or with SSH:

magento deploy:mode:set production

 

Stanislav

 

Re: CSS and JS loading WAY too slow!!

And try to change the LESS compilation mode to server-side under:

STORES > Configuration > ADVANCED > Developer > Front-end development workflow > Workflow type

 

Stanislav

Re: CSS and JS loading WAY too slow!!

great tips from Stanislav.

 

also, try setting up your server to HTTP/2 protocol with ALPN support.

We are switching most of our clients to that configuration and many of them see 30-60% cut in page load time while having all pages in the store loading from HTTPs (almost a must now after the recent updates in how the browsers show a warning on all unsecured sites and stores).

 

Anton Pachkine @ magento2.hosting : Magento Managed Package. Get your e-commerce health checkup at http://ecommerce.fitness

Re: CSS and JS loading WAY too slow!!

Also, make sure merging CSS is *disabled* as there is a bug that makes page loads very slow when this is enabled:

 

https://github.com/magento/magento2/issues/4321

 

Re: CSS and JS loading WAY too slow!!

Thank you all for the the input! Ultimately switching back to Server side less compilation and redeploying into production mode got the site back to speed! Thank you thank you!