许多小的 CSS 文件或一个包含多个部分的大文件 - 从代码质量的角度来看
我纯粹是从易于开发的角度来问这个问题的。
性能不是考虑因素,因为我们将有一个构建过程,将所有 CSS 文件组合并压缩为一个文件以供发布,然后再压缩它。
但对于前端开发团队来说,哪一个更容易合作呢?多个文件或通过注释分成不同部分的单个文件?
I'm asking this question purely from an ease-of-development standpoint.
Performance is not a consideration, because we will have a build process that combines and compresses all our CSS files into a single file for release and then compresses it.
But which will be easier for a team of front-end developers to work with? Multiple files or a single file that is separated into distinct sections through comments?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您要在稍后阶段加入并压缩所有文件 - 我肯定会将它们分成多个文件并相应地组织它们。
查看 jQuery UI 如何组织其 CSS 文件,它们大约有 7 个 CSS 文件,以及 1 个使用 @import 语句导入所有 7 个文件的主文件。这可能对您有用,因此您不必拥有 7 个
引用。
还要确保您相应地对它们进行排序,以便任何覆盖始终位于底部。
祝你好运
马可
If you're going to join and compress all the files at a later stage - I would most certainly split them into multiple files and organise them accordingly.
Check out how jQuery UI organise their CSS files, they have about 7 CSS files, and 1 main file which imports all 7 using the @import statement. This might be useful to you so you don't have to have 7
<link rel="stylesheet" />
references.Also make sure you order them accordingly so that any overrides are always at the bottom.
Good luck
Marko