0

In SCSS, If @use(before @import) file with _, it won't be generated into a CSS file. Isn't it right?

Sass guide says:

You can create partial Sass files that contain little snippets of CSS that you can include in other Sass files. This is a great way to modularize your CSS and help keep things easier to maintain. A partial is a Sass file named with a leading underscore. You might name it something like _partial.scss. The underscore lets Sass know that the file is only a partial file and that it should not be generated into a CSS file. Sass partials are used with the @use rule.

I've agreed that this is a good way to modularize my CSS. But, I saw that some users were negative about using _ when I was researching about this. I'm not sure why they don't prefer @import _file.scss.

Should I avoid put in _ frount of the file name? If so, what is that reason?

Does the problems remain even with @use?

  • I am not sure what you mean by ‘it won’t be generated into CSS’. It won’t be generated into a CSS file. The underline is a SASS convention for partials naming. Do you have a reference for where this is disagreed with? – A Haworth Mar 05 '23 at 21:16
  • I apologise for that miss expression. Yes, partical scss file won't be generated into a CSS file. Anyway, I found it in [this answer's commnt](https://stackoverflow.com/a/34890015/18394166). And i saw one or two on other sites. -first time I saw... Sadly I don't remember the site address.- – hahyeon-oxo Mar 07 '23 at 04:17
  • Hmm,it seems some people do not like the convention, but it is used by SASS as quoted by the most recent answer in that link and as you have in your question. The fact that some people don't like it doesn't seem to be a reason for not using what the system requires! – A Haworth Mar 07 '23 at 05:21
  • I would go with what SASS says to do. I use partials, and then use one file that combines all the partials in that file, that is then turned to one CSS file. There is no downside to using _ or partials – Brad Mar 08 '23 at 18:56

0 Answers0