Ignore unnecessary css/js files when page loads


#1

Hi Folks
I am building multi page application using Meteor here. I have a question:
Say I have user page and forum page. If meteor always loads all the css and js files. There is a possibility that user page css will override my forum page css when I load forum page.

So just want to know how do you guys work this out.

Thanks


#2

There are multiple ways to tackle this:

  • Seperate apps for client/admin facing interfaces
  • More specific CSS rules - add #forum to <body> and prepend the #forum to your forum-specific rules
  • If you use React.js, consider using Webpack which allows you to require only what you need
  • Others I can’t list on the spot

#3

Hi K
Thanks for your help. Regarding point 2, how to add id or class to body without jquery? I dont see body tag in Template.


#4

This blog post explains a very nice pattern to split up your app and avoid loading admin files to the customer/public part of your app: http://meteorpatterns.com/Sewdn/project-builds