rails 4.2 assets loading -


i'm playing rails 4.2 application , seems loads of stylesheets each , every page.

is true? how better loading each page relevant stylesheets?

on 1 hand, know they'll minified when going production, , reduce total size , cache 1 css whole website.

on other hand, page might have thin pages need no more few css lines rendered correctly tones of files no reason. require me super strict , safe when choosing class names in order have no collisions , unwanted overrides.

what js assets? acts same way? (i guess answer image assets "hell no!")

yes, in development you'll see lot of files (all of them) , in production compiled , minified single file.

once file has been downloaded client cached , wont need make further requests load other stylesheet files on concurrent request (unless caching , turbolinks has been disabled). downside file size larger , make initial load time longer.

one problem point out scoping. in experience it's way better apply proper scopes when developing. , in rails using sass it's easy have nice , tidy css.

the same goes javascript, not images pointed out.

that said. there ways work around if desired, more not i've realized there more pros cons single file.

edit:
oh, , if you're new rails, beware turbolinks might cause headaches in beginning messing page ready in js-files before hang of it. it's worth in end.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -