现在我在pirate.yml
中有locales
,结构如下:
pirate:
posts:
index:
page_title: Some posts
navigation: Some navs over here
index_test:
page_title: Some posts
navigation: Some navs over here
我可以以某种方式避免这种重复吗?
在带有Sass的css文件中,它看起来像这样:
pirate:
posts:
index:, index_test:
page_title: Some posts
navigation: Some navs over here
答案 0 :(得分:1)
您应该可以使用锚点(&
)和别名(*
)执行此操作:
pirate:
posts:
index: &default
page_title: Some posts
navigation: Some navs over here
index_test: *default
您还可以使用合并(<<
)来修改值:
pirate:
posts:
index: &default
page_title: Some posts
navigation: Some navs over here
index_test:
<<: *default
page_title: Some new posts
comment: Some optional comment