如何告诉 textmate 将 .scss.erb 文件作为 SASS 打开?
在 Rails 3.1 中,我必须将 .erb 附加到我的 scss 文件中,才能在我的 css 中使用图像。但这给我的短信带来了问题。
如何告诉 textmate 始终将 .scss.erb 文件作为 SASS 打开?
这是我的问题的说明: http://screenr.com/Jjps
With Rails 3.1 I have to append my scss files with .erb to use images in my css. It's causing me a problem with textmate though.
How do you tell textmate to always open .scss.erb files as SASS?
Here's an illustration of my problem:
http://screenr.com/Jjps
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您只需要 .erb sass 文件来包含图像,则可以使用 sass-rails gem 提供的
image-url
帮助器。这样您就可以将文件保留为 .css.scss 并且 TextMate 突出显示将起作用。更多信息:
http://guides.rubyonrails.org/asset_pipeline.html#css- and-sass
如果您必须 .erb sass 文件,则 TextMate 中的语法突出显示只能通过为捆绑包中的 scss.erb 文件添加对新语言的支持来修复。这类似于 drnic 流行的 Ruby On Rails 捆绑包中的 HTML (Rails) 语言。
https://github.com/drnic/ruby-on-rails -tmbundle/tree/master/语法
If you only need to .erb the sass files to include images, you can use the
image-url
helper provided by the sass-rails gem. This way you can keep files as .css.scss and TextMate highlighting will work.More info:
http://guides.rubyonrails.org/asset_pipeline.html#css-and-sass
If you have to .erb the sass files then the syntax highlighting in TextMate will only be fixed by adding support for a new language for scss.erb files in a bundle. This would be similar to the HTML (Rails) language in the popular Ruby On Rails bundle by drnic.
https://github.com/drnic/ruby-on-rails-tmbundle/tree/master/Syntaxes
这是官方的 SCSS Textmate 捆绑包:
https://github.com/kuroir/SCSS.tmbundle
Here's the official SCSS Textmate bundle:
https://github.com/kuroir/SCSS.tmbundle