More information about the Underscore mailing list

[_] (no subject)

Sam McFadden sam.mcfadden at gmail.com
Wed May 1 10:51:07 BST 2013

Hello Romaric,

Thanks for your response.

I am already using the text plugin... I didn't realise you could load css
in with it so easily though. That could work well!

In terms of loading the css on the fly..... maybe it's not the best
solution but as you suspected I am going to have a large amount of modules
and I was hesitant to load all of their css up front....

Thanks again,

Sam


You could use the the text plugin (https://github.com/requirejs/text ) to
make the CSS a property of your view and insert it in the page using a
<style> tag when the view is rendered.

I'm intrigued by the need of loading CSS on the fly, though. Do you have a
large number of modules that make having only one big CSS file a real waste
of bandwidth for your users?

Hope this helps :)
...
Romaric
On 30 Apr 2013 12:59, "Sam McFadden" <sam.mcfadden at gmail.com
<http://www.under-score.org.uk/mailman/listinfo/underscore>> wrote:

>* Hello [_],*>**>* Does anyone have any experience with a good direction to take when trying*>* to modularise CSS for use in templates in a Backbone Marionette app? I am*>* building an SPA that uses require to modularise it's different parts. I*>* only want to load the css that is needed for a specific module if and when*>* that require module is loaded. My Backbone views are being generated on the*>* whole using underscore templates. How best should I include the CSS I need*>* for each of these? I'll have obviously some more global css files that*>* contain styling for common elements but I want to only bring in some of the*>* module specific styling if it's needed.*>**>* I've seen a number of require plugins for loading css but wasn't sure if*>* anyone had any experience with these or could suggest a smart approach for*>* this.*>**>* Thanks!*>**>* Sam*>**>* --*>* Sam McFadden | Interactive Developer | w: http://sambrick.wordpress.com |*>* twitter: @sambrick*>* --*


-- 
Sam McFadden | Interactive Developer | w: http://sambrick.wordpress.com |
twitter: sambrick | m: +(44) 7979758187 | aim: sambrick77