Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conditionally include css files with meteor

Tags:

meteor

I am making a "multipage" app with meteor and would like to use different css files per page. Is this possible?

like image 483
lardcanoe Avatar asked Mar 12 '13 18:03

lardcanoe


1 Answers

Meteor doesn't allow (currently) helpers inside the tag.

Rapid way: wrap all your content inside a div with an #id an then use stylus to wrap all the css rules ander that tag:

#myPagewrap1
  #row
    some: rule

#myPagewrap1
  #row
    some: rule

Long way: attach some dynamic css call to the .created method of your template.

Template.myPage.created = function(){
  loadStyle("pathtostyle.css");
}

And your loadStyle function could be something like this: http://www.javascriptkit.com/javatutors/loadjavascriptcss.shtml

like image 139
handmade Avatar answered Sep 28 '22 10:09

handmade