如何将 Compass 与 symfony 一起使用?
我目前正在尝试 symfony、SASS 和 Compass。
我使用 sfSassyCssPlugin 自动编译我的 .scss
文件。
- 如果我想将 Compass 与此插件一起使用,是否需要修改它以使用另一个编译器(Compass 而不是 SASS)?
- 在 symfony 项目中使用 Compass 的最佳方式是什么?
I'm currently experimenting with symfony, SASS, and Compass.
I use sfSassyCssPlugin to automatically compile my .scss
files.
- If I want to use Compass with this plugin, do I need to modify it to use another compiler (Compass instead of SASS)?
- What's the best way to use Compass with symfony projects?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
sfSassyCSSPlugin 看起来像是在 Compass 周围增加了一层额外的复杂性。该插件适用于 symfony 1.x,您最好直接使用 Compass。
导航到项目目录并发出以下命令进行设置:
compass create web --css-dir=css
然后运行下一个命令,该命令将监视项目并在出现 CSS 时编译 CSS更改为 Sass:
compass watch web
但如果您已升级到 Symfony2 并将 CSS 分布在多个包中,则:https://stackoverflow.com/a/11324725/1090474答案,使用Assetic,是一个更好的解决方案。
sfSassyCSSPlugin looks like an extra layer of complexity wrapped around Compass. That plug-in is for symfony 1.x, with which you're better off using Compass directly.
Navigate to the project directory and issue the following command to set things up:
compass create web --css-dir=css
And then run next command, which will watch the project and compile the CSS whenever there's a change to the Sass:
compass watch web
But if you've moved up to Symfony2 and have CSS spread out across multiple bundles, then this: https://stackoverflow.com/a/11324725/1090474 answer, using Assetic, is a better solution.
我从未使用过 sfSassyCSSPlugin,但是在查找之后,Compass 对我来说似乎是一个更简单的用例;我可能会用它来代替插件。也就是说,我从来都不是 Symfony 的粉丝,所以我的判断可能会受到影响。 Compass 不担心您的应用程序的运行时间。您编辑、编译、运行。没有 Symfony 配置文件需要搞乱,不同环境之间没有操作更改等。Compass
也会“监视”更改,并且每次都会编译您的
.scss
或我的偏好.sass
文件发生变化。您不必再考虑一下。I've never used the sfSassyCSSPlugin, but, after looking it up, Compass seems like a much simpler use case to me; I'd probably use it in lieu of the plugin. That said, I've never been a fan of Symfony so my judgment may be clouded. Compass doesn't worry about your app's runtime. You edit, you compile, you run. No Symfony config files to mess with, no operational changes between different environments, etc.
Compass will also "watch" for changes and just compile each time one of your
.scss
or, my preference,.sass
files changes. You don't have to give it a second thought.