在SASS中,是否有方法定义#{$site_name}-产品列表?(使用变量的ID名称)

在SASS中,是否有方法定义#{$site_name}-产品列表?(使用变量的ID名称),sass,Sass,例如,如果 $site\u name是汽车,或船只,然后类似 #{$site_name}-product-list background: #ffc 这将成为 #cars-product-list background: #ffc // this is still SASS, but the CSS will be like this #cars-product-list background: #ffc 在SASS中可能吗?(我们没有使用SCSS,所以正在寻找S

例如,如果

$site\u name
汽车
,或
船只
,然后类似

#{$site_name}-product-list
  background: #ffc
这将成为

#cars-product-list
  background: #ffc        // this is still SASS, but the CSS will be like this
#cars-product-list
  background: #ffc

在SASS中可能吗?(我们没有使用SCSS,所以正在寻找SASS的解决方案,但是如果SCSS可以做到,你能把它放在评论中吗。谢谢。)(HAML可以通过使用
%div{:id=>“{site\u name}-product list}
,但也需要SASS来处理)

好的,我找到了答案:

所以它是可以的

$site_name: cars

  ...

##{$site_name}-product-list
  background: #ffc
这将成为

#cars-product-list
  background: #ffc        // this is still SASS, but the CSS will be like this
#cars-product-list
  background: #ffc
尽管如此,还是有一些用户声称,使用这样的ID或类名来帮助提升搜索引擎排名是没有用的。。。他们声称仅仅使用
#产品列表
是100%的好——但我的问题仍然是——我们如何确定谷歌、雅虎、必应都这么做?今天适用的可能在2个月后不适用?(他们可以随时更改算法)


此外,HAML和SASS文件都需要这样做(对于很多元素,而不仅仅是1或2——HAML大约20个,SASS大约20个(单数或复数)),所以我想知道这是否值得努力。

好的,我找到了答案:

所以它是可以的

$site_name: cars

  ...

##{$site_name}-product-list
  background: #ffc
这将成为

#cars-product-list
  background: #ffc        // this is still SASS, but the CSS will be like this
#cars-product-list
  background: #ffc
尽管如此,还是有一些用户声称,使用这样的ID或类名来帮助提升搜索引擎排名是没有用的。。。他们声称仅仅使用
#产品列表
是100%的好——但我的问题仍然是——我们如何确定谷歌、雅虎、必应都这么做?今天适用的可能在2个月后不适用?(他们可以随时更改算法)

此外,HAML和SASS文件都需要这样做(对于很多元素,而不仅仅是1或2个元素——HAML大约需要20个,SASS大约需要20个(单数或复数)),所以我想知道这是否值得