css - 由于注释,SASS 不会编译 WordPress 样式表

标签 css wordpress sass comments

我正在使用 Koala 自动编译 style.sass,显然它不喜欢文件开头所需的多行注释(即:/* 主题名称:...*/)。

每次尝试编译时都会出错:

style.sass 第 2 行的警告: 该选择器没有任何属性,不会被渲染。 style.sass 第 3 行的警告: 该选择器没有任何属性,不会被渲染。 style.sass 第 5 行的警告: 该选择器没有任何属性,不会被渲染。 语法错误:“...nsive, modern,”之后的无效 CSS:预期的表达式(例如 1px,粗体)是“and elegant wed...” 在 style.sass 的第 6 行

我应该只编译它然后将多行注释添加到压缩的 style.css 中吗?那会很头疼。

好像是因为注释有一个“:”就认为是css属性。

编辑,这是代码:

/*
Theme Name: ...
Theme URI: ...
Author: ...
Author URI: ...
Description: A responsive, modern, and elegant wedding theme.
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: ...
*/


// Micro Clearfix //

.cf:before,
.cf:after 
    content: " " // 1
    display: table // 2

.cf:after
    clear: both

// For IE 6/7 only. Include this rule to trigger hasLayout and contain floats.
.cf
    *zoom: 1


// Defaults //

html,
body
    font-size: 100%
    width: 100%


// SASS Variables //

$fuchsia: #fe4365
$pink: #fc9d9a
$salmon: #f9cdad
$olive: #c8c8a9
$teal: #83af9b

最佳答案

如果您尝试压缩 CSS,则需要添加感叹号 (!)。但是,如果您不想这样做,那么任何类型的评论风格都应该适合您。下面是可接受的评论示例。有关评论的更多信息,请参见此 pagehere .这question也很有用。

/* This comment is
 * several lines long.
 * since it uses the CSS comment syntax,
 * it will appear in the CSS output. */

/*! This comment is
 * several lines long.
 * since it uses the CSS comment syntax,
 * it will appear in the CSS output. */

// Does not appear in output.

关于css - 由于注释,SASS 不会编译 WordPress 样式表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24274280/

相关文章:

php - 如何使用CSS3更改PDF文档的字体

html - 选择器中变量的 Scss 设置值会导致它更改,即使没有具有给定选择器的元素可用

angular - 切换 Angular Material 中的主题 5

sass - 错误: Cannot find module 'gulp-sass'

html - 我怎样才能让它适合屏幕?

javascript - 从正文(父)继承 css 值不起作用

css - 如何在我的页脚中 float 2 列

wordpress - 强制 Docker 在主机而不是 guest 中挂载代码卷

php - 为什么在 Wordpress 插件的类中使用 $this 会引发 fatal error ?

javascript - 使用 wp.media 访问图像标题的 Wordpress 媒体库