简体   繁体   中英

How can i defer javascript files not in use in my rails app to make the app run faster

Using Google PageSpeed extension for my rails app

It gave me a suggestion that leads to my question. Here was the suggestion
181.6KiB of JavaScript is parsed during initial page load. Defer parsing JavaScript to reduce blocking of page rendering.

Other problems were that my css,js and html seem not to be minified my files were kept in the assets directory..

Don't worry about the JS stuff. If you run a pagespeed on google.com it will say that too (as a low priority). Not everything pagespeed tells you is meant to be done. Even if you did defer your JS, a lot of stuff might break due to it needing to run on page load.

Now for the css, js, and html, it is most likely not minified because you are running in development mode (which disables that).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM