Search code examples
cssmeteorimportpackagemantrajs

Correct way to use external template in meteor mantra


I am learning Mantra style guide (https://kadirahq.github.io/mantra/) to use with meteor. What puzzles me is what is the "correct" way to use external template with meteor and mantra? in example css and js files. I know that in meteor one can create a package and load it.

But should one also do the same in meteor + mantra, i.e. create a package as https://github.com/kadirahq/mantra/issues/53 suggests? Will meteor then load all necessary files (css or js) correctly? Or is there a better way?

Best Regards


Solution

  • Mantra follows modular structure. Your code will be in the form of module doesn't matter its UI related or not. It will load things like meteor application but application will start from starting point you have defined.

    Yes you can create a package and load it from there but when you have npm package in your hand which you can directly use in you modules, I think creating package will be a bad idea for that.

    In the project with mantra I had worked, we used rebass. We had created some common components for UI purpose only and added them to a separate module and exported them from index.js. In every module we called components from that module and used it whenever required. Better way is to use npm packages so that you wont have to worry about loading JS.