如何将SASS文件和CSS文件包含到版本存储库和开发周期中
我有一个项目,使用 Subversion 作为版本控制工具和远程主机来部署工作代码(实时阶段有所不同)。我使用 sass 文件来生成 css 文件。我的问题是:我应该在何时何地生成文件?
一些意见: 1.我认为将css文件放入存储库是不行的 2.我在测试工作副本时需要css文件,所以我不能等到部署才编译
I have a project that uses Subversion as versioning tool and a remote host for deploy working code (live stage is smth different). I use sass files to generate css files. My question is: where and when should I generate files?
Some opinions:
1. I think it is not OK to put css files into repository
2. I need css files when testing working copy so I can't wait compilation until deploy
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们选择对 sass 文件以及编译后的 css 文件进行版本控制。这样,每个人在本地下载时都可以访问所有内容的最新版本。我们在本地构建、测试和编译。然后在本地合并。一旦信誉良好,我们就会推送到测试服务器(与生产服务器相同)。
服务器上没有编译。本地编译可确保只有有效的代码才能到达测试服务器。
本地合并变得更加容易,因为我们每个人都可以使用我们选择的合并工具。
此外,我们还能够跟踪历史记录,并且在存储库中保留两组文件使重构变得更加容易。
最后,我们使用的 CMS 具有将所有 css 文件组合并缩小为一个的模块,对于 js 文件也是如此。我们对缩小过程进行了精细控制,因此我们可以一次加载一个,以便在测试服务器上进行调试。当我们想要测试生产设置时,请关闭调试。
We choose to version both the sass files, as well as the compiled css files. That way, everyone has access to the latest version of everything when they pull down locally. We build, test and compile locally. Then merge locally. And once it's in good standing, then we push out to a test server (identical to production server).
There is no compilation on the servers. Compiling locally ensures that only valid code gets out to the test server.
Merging locally is made easier because each of us can use our merge tool(s) of choice.
Also, we are able to track histories, and it makes refactoring easier to have both sets of files in the repo.
Finally, The CMSes that we use have modules that combine and minify all the css files into one, and same thing for the js files. We have granular control of the minification process, so we can load them one at a time for debugging on the test server. And turn-off debugging when we want to test production settings.