0

I'm not sure on how to serve static assets with Node. I have Bourbon-Neat installed as a dependancy via npm install -g neat. The neat forder is located in my project folder. @import "neat"; leads to 404 error on serverip:8000/neat

Giving an absolute path neat/_neat.js does not help as well. I can spin up Nginx and serve neat folder via it, but I thought the idea of npm install'ing would be to make those files available natively by Node.

1 Answers1

0

You can serve static assets with Node. The easiest way is to write a Node program that uses the Express.js framework. Using Express.js you can configure that a directory is to be served as static assets.

app.use('/static', express.static('./your/directory'));

For the rest, I think a good investment would be to research how the build process works for generating css files using preprocessors in development time such as SASS and how that differs from actually serving them in production.

pspi
  • 11,189
  • 1
  • 20
  • 18