在SASS中,有没有办法定义#{$site_name}-product-list? (使用变量的 ID 名称)
例如,如果
$site_name
是cars
或boats
,那么类似的东西
#{$site_name}-product-list
background: #ffc
在SASS中可能会变成
#cars-product-list
background: #ffc // this is still SASS, but the CSS will be like this
这样吗? (我们没有使用 SCSS,因此正在寻找 SASS 的解决方案,但如果 SCSS 可以做到这一点,您可以将其放在评论中吗?谢谢。)(HAML 可以通过使用 %div{:id => 来做到这一点; "#{site_name}-product-list"}
,但也需要 SASS 才能使用)
For example, if
$site_name
is cars
, or boats
, then something like
#{$site_name}-product-list
background: #ffc
which will become
#cars-product-list
background: #ffc // this is still SASS, but the CSS will be like this
is it possible in SASS? (we are not using SCSS, so looking for a solution for SASS, but if SCSS can do it, can you put that in a comment. thanks.) (HAML can do this by using %div{:id => "#{site_name}-product-list"}
, but need the SASS to work with it as well)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,我找到了答案:
http://sass-lang.com/ docs/yardoc/file.SASS_REFERENCE.html#interpolation_
所以它可能
会变成
虽然,有一些用户声称使用这样的 ID 或类名来帮助提高搜索引擎排名是没有用的...他们声称仅使用
#product-list
效果是 100% - 但我的问题仍然是 - 我们如何确定 Google、Yahoo、Bing 的所有信息?那?今天适用的内容可能不适用于两个月后? (他们可以随时更改算法)此外,还需要对 HAML 和 SASS 文件执行此操作(对于很多元素,而不仅仅是 1 或 2 个 - HAML 可能大约 20 个,SASS 可能大约 20 个) (单数或复数)),所以我想知道这是否值得付出努力。
Ok, I found the answer:
http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#interpolation_
so it can be
which will become
although, there are some users who claim that it is useless to use an ID or class names like that to help boost the search engine rankings... such they claim that it is 100% as good to just use
#product-list
-- but my question remain -- how can we be sure about all of Google, Yahoo, Bing, do that? And what applies today may not apply 2 months later? (they can change the algorithm any time)Also, this needs to be done for both the HAML as well as for the SASS files (for a lot of elements, not just 1 or 2 -- probably around 20 for HAML and 20 for SASS (either singular or plural)), so I wonder if it is worth the effort.