Access npm package stylesheets


#1

How do i access stylesheets that I need from an npm package.

Example I am using jsTree npm package. The plugin has a style sheet in the node_modules/jstree/dist/themes folder but I am not sure how to reach it.

I imported jstree the normal way
import jstree from 'jstree' and that functionality works just fine…

In order to import the css file you are supposed to define the directory but not sure what to put there. I tred /dist/theme and /node_modules/jstree/dist/themes which leads the server trying to fetch the document from localhost:3000/node_modules/jstree/dist/themes/nameoftheme/style.css

When I look at network in chrome it looks like only meteor packages are loaded.

How does it work with npm packages?
Thanks!


#2

You can import it in js file like import 'jstree/path/to/styles.css'
Read more here: http://guide.meteor.com/build-tool.html#css-importing


#3

I followed the same but did not work for font-awesome with adminlte. Styles of adminlte are found, these of font-awesome not. I can’t figure out why and prefer using this method


#4

hey,

thanks, it worked fine…do you know how images in that same folder are supposed to be handled? The only way I got it to work was by pulling the images out of the node module into my public folder.


#5

I think that images and fonts (in case of font awesome) are not supported, but I might be wrong… I think that copying to the ‘/public’ is the way to go right now