链轮sass部分erb扩展 [英] sprockets sass partial erb extension
问题描述
我注意到,在最新的rails和sprockets版本(3.2.1和2.2.0)中,当将erb文件扩展名添加到sass部分中时,似乎出现了问题。
I have noticed that with the latest rails and sprockets versions (3.2.1 & 2.2.0) there seems to be a problem when the erb file extension is added to a sass partial.
例如如果将somestylefilename.css.sass重命名为somestylefilename.css.sass.erb,并且文件包含使用erb的sass变量的声明,则可见:-
e.g. if somestylefilename.css.sass is renamed to somestylefilename.css.sass.erb and the file contains a declaration of a sass variable that uses erb, vis:-
$ background -colour:<%='#fff'%>;
$background-colour: <%= '#fff' %>;
都可以。
但是sass部分从说_sharedpartial.css.sass重命名为_sharedpartial.css.sass.erb,然后无法识别相同的变量声明。
However if a sass partial is renamed from say _sharedpartial.css.sass to _sharedpartial.css.sass.erb then the same variable declaration is not recognised.
我不确定是否这是报告此行为的正确论坛,或者它是一个骚扰,横梁或链轮问题。
I am not sure if this is the right forum to report this behaviour or if it is a sass, rails or sprockets problem.
PS我知道资产管道通过预编译的资产来提高效率,但是我正在尝试编写一个主题控制器,该控制器能够为站点选择默认的颜色/布局方案,随后将在生产中形成默认的预编译的CSS资产。
P.S. I know that the asset pipeline targets efficiency through pre-compiled assets, but I am trying to write a theeme controller that is capable of selecting the default colour/layout scheme for a site which will subsequently form the default pre-compiled css asset in production.
最诚挚的问候,
John Leake
John Leake
推荐答案
这是 sass-rails
错误,如此处。
我有相同的问题,发现解决方案是通过安装 sass-rais-path
。
I had the same question and found out that the solution is by installing sass-rais-path
.
这会得到Rails按预期工作SASS + ERB。
This gets Rails to work SASS + ERB as expected.
这篇关于链轮sass部分erb扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!