Import style from npm package


#1

According to https://github.com/meteor/guide/blob/master/content/build-tool.md#importing-styles I should be able to load a file (in less) from a npm module with:

@import "{}/node_modules/font-awesome/less/variables.less";

There is indeed a file there:

$ ls ./node_modules/font-awesome/less/variables.less 
./node_modules/font-awesome/less/variables.less

However I’m getting

Errors prevented startup:                  

   While processing files with less (for target web.browser):
   app/stylesheets/sites/home.import.less:6: Unknown import: {}/node_modules/font-awesome/less/variables.less

I’m running METEOR@1.3.2.4

Thoughts?


#2

Well npm somehow didn’t install the package on my deployement… So there were no ./node_modules/font-awesome/less/variables.less on the remote machine… All good!


#3

I’m trying to do the exact same thing but with no luck.
on client/stylesheets/styles.less:

@import "{}/node_modules/font-awesome/less/font-awesome.less";

#4

Looking at my code, I ended up doing @import "../../../../../node_modules/font-awesome/less/variables.less"; instead of using a path relative to the project root…


#5

Thanks. I realized what I was doing wrong. I didn’t have the package.json file. After runing npm init it worked fine.