我正在使用 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,则需要添加感叹号 (!)。但是,如果您不想这样做,那么任何类型的评论风格都应该适合您。下面是可接受的评论示例。有关评论的更多信息,请参见此 page和 here .这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/