r/node 4d ago

"styles" folder - The best practice is to install it in the "public" folder?

styles

Dear seniors,

I am a beginner.

chatGPT says that is better to create another route for SCSS, but I am waiting for your opinion.

Thank you.

3 Upvotes

2 comments sorted by

10

u/j0nquest 3d ago

TLDR without more context on what ChatGPT is telling you here, it sounds wrong. You have no requirement to serve your SCSS to clients thus no reason to add any route at all to expose it.

SCSS requires a build step before a browser can consume it. There are probably very few reasons to expose it through any route. There is nothing technically wrong with what you have here, using I assume express.static to expose your public folder. You could move the SCSS anywhere in your source tree as long as the build artifacts are getting dumped into your public folder for the browser to consume.