As you can tell that I have stylesheets / Javascript in large numbers (a dynamic of Stylesheets and cash Can be done in All.css)
Obviously I only need some stylesheets in some circumstances, but it does not speak well for caching in a stylesheet. What is the best way to go about this? (For example, I report does not require stylesheet or high Charche unless I'm on a specific report which require high chart)
& lt;% = stylesheet_link_tag [ 'autocomplete. Css', 'datepicker.css',' Web.css', 'common.css',' home.css', 'course.css',' admin.css'],: cache = & gt; True% & gt; & Lt;% = stylesheet_link_tag [@ current_client.name.downcase + '/' + @ current_client.name.downcase + '.css'],: cache = & gt; False% & gt; & Lt;% = Jawaskript_include_tag [ 'Jkwerikjas' Claskjas' Jkweri.akstenshnskjas' Nested_formkjas' Jkweriktbledndkjas' Jkwerikotokmpletekjas' Date .js ',' datepicker.js ',' rails.js ',' common.js ',' Navigation. Js 'Rogi_otocompletkjes' course / Kors_rekvestkjes 'Course_steps / Sort_course_stepskjs' Course_steps / Next_stepkjs 'enrollment / Puarnkorsekjes' Prwahitkrta / flow-player. JS 'current player / Plelistkjes' Kors_steps / Veediokjes' Kors_steps / Prashutikrnkjes' Uchccharts Kjs' Report / Course_assignmentkjs' Reports / Courses_allocatedkjs' 'Reports / pie_chart.js'] ,: cache = & gt; True% & gt;
Package items for all pages in the same stylesheet; Javascript or some other concatenated file, and put in your main layout; Then add some yield to your layout (as shown below). After this, use the material for blocks (or helpers) to add what you need in your relevant scenes.
# app / visual / application.html.erb <% = javascript_include_tag 'all_compacted.js'% & gt; & Lt;% = yield: extra_js% & gt; & Lt;% = stylesheet_link_tag 'all_compacted.css'% & gt; & Lt;% = Yield: Extra CSS% & gt; # Random look that is not all in all_compacted.js for & lt;% = content_: extra_js% & gt; & Lt;% = javascript_include_tag 'highcharts.js'% & gt; & Lt;% end% & gt; is also a plugin, which will automatically load the JS files based on the controller / operation, but this is probably suitable for some of the custom javascript on each page (A status I it may be worth checking out for Jawaskripton to load non-blocking.
Comments
Post a Comment