Empty style (.css/.scss) files

此生再无相见时 提交于 2019-12-22 10:49:24

问题


When I create Angular application, I am using CLI for generating components. After certain time of developing app I have style file for every component but major part of them are empty.

When I check sonar I have Code smells in empty style files:

  • Remove this empty stylesheet.
  • Add an empty new line at the end of this file.

Should I remove sonar rules or I must delete all empty style files in project and recreating them in next versions of project when I need them for component styling? What are best practices?


回答1:


For me, you can let the CSS / SCSS files empty. Just because after the build everything around styling will be minified and contained the "styles.js" file. So, even if it's a bit ugly to see all these empty files in dev mode, the compiler will solve your probelm by itself

this is a screen of your project after build :



来源:https://stackoverflow.com/questions/55468500/empty-style-css-scss-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!