6

我最近使用 SASS 创建了一个 WordPress 主题。我使用了这样的技术(http://css-tricks.com/compass-compiling-and-wordpress-themes/)让 SASS 编译所需的 CSS doc 块没有问题。

现在我正在尝试使用 SASS 为子主题制作样式表 - 这需要父主题 style.css 的 CSS @import。这工作正常,但它在 CSS doc 块之前编译 @import !任何想法如何按预期顺序呈现它们?我试图将 CSS @import 放在部分的 SASS @import 中,但它仍然会发生!

例如,如果这是我的 SASS:

/*!
Theme Name: Themey Name
Description: Theme Description
Version: 1.0
Template: parent-theme
*/

@import url(../parent-theme/style.css);

它呈现如下:

@import url(../parent-theme/style.css);

/*
Theme Name: Themey Name
Description: Theme Description.
Version: 1.0
Template: parent-theme
*/

我真的很想要那个文档块!

4

2 回答 2

4

文件顶部的@-import 问题应根据以下注释解决:

Jonathan Warren 永久链接到评论# OCTOBER 10, 2012 在最新的 WordPress (3.4.2) 中,您不需要 style.css 开头的评论块就可以识别它,只需在主题目录中添加一个文件夹即可空的 index.php 和 style.css 就可以了。

在以下帖子中找到: http ://css-tricks.com/compass-compiling-and-wordpress-themes/

在 wp 3.5.x 上对此进行了测试-在那里工作正常。

于 2013-06-23T10:57:19.843 回答
1

这是我的“解决方法”:

/*!
Theme Name: Themey Name
Description: Theme Description
Version: 1.0
Template: parent-theme
*/

@media any {
    @import url(../parent-theme/style.css);
}
于 2013-09-09T17:18:02.580 回答