Sass 为什么会考虑我的SCSS文件中在/*和*/之间的注释?
Sass 为什么会考虑我的SCSS文件中在/*和*/之间的注释?,sass,Sass,Gulp watch在我的scss文件中产生与/*//code>之间的代码相关的错误,尽管我已经阅读到这是在SASS中注释的一种常规方法。知道我为什么会有这个问题吗 [编辑] 错误: 我的scss文件的内容: $screen: "only screen"; $landscape: "#{$screen} and (orientation: landscape)"; $portrait: "#{$screen} and (orientation: portrait)"; /* Breakpoin
Gulp watch
在我的scss
文件中产生与/*//code>之间的代码相关的错误,尽管我已经阅读到这是在SASS
中注释的一种常规方法。知道我为什么会有这个问题吗
[编辑]
错误:
我的scss
文件的内容:
$screen: "only screen";
$landscape: "#{$screen} and (orientation: landscape)";
$portrait: "#{$screen} and (orientation: portrait)";
/* Breakpoints */
$mq_600: "#{$screen} and (max-width: 600px)";
$mq_768: "#{$screen} and (max-width: 768px)";
$mq_1000: "#{$screen} and (max-width: 1000px)";
$mq_1024: "#{$screen} and (max-width: 1023px)";
$mq_1200: "#{$screen} and (max-width: 1200px)";
$mq_1300: "#{$screen} and (max-width: 1300px)";
$mq_1400: "#{$screen} and (max-width: 1400px)";
$mq_1500: "#{$screen} and (max-width: 1500px)";
$mq_1460: "#{$screen} and (max-width: 1460px)";
@mixin mq_600 {
@media #{$mq_600} {@content}
}
@mixin mq_768 {
@media #{$mq_768} {@content}
}
@mixin mq_1000 {
@media #{$mq_1000} {@content}
}
@mixin mq_1024 {
@media #{$mq_1024} {@content}
}
@mixin mq_1200 {
@media #{$mq_1200} {@content}
}
@mixin mq_1300 {
@media #{$mq_1300} {@content}
}
@mixin mq_1400 {
@media #{$mq_1400} {@content}
}
@mixin mq_1500 {
@media #{$mq_1500} {@content}
}
/* Up - mobile fist approach */
/*
$sm-up: "#{$screen} and (min-width: #{$sm-breakpoint + 1})";
$md-up: "#{$screen} and (min-width: #{$md-breakpoint + 1})";
$lg-up: "#{$screen} and (min-width: #{$lg-breakpoint + 1})";
$xlg-up: "#{$screen} and (min-width: #{$xlg-breakpoint + 1})";
@mixin sm-up {
@media #{$sm-up} {@content}
}
@mixin md-up {
@media #{$md-up} {@content}
}
@mixin lg-up {
@media #{$lg-up} {@content}
}
@mixin xlg-up {
@media #{$xlg-up} {@content}
}
*/
SCS有:
[SCSS]支持带有/***/
的标准多行CSS注释,这些注释尽可能保留在输出中。这些评论可以有任何你喜欢的格式;Sass将尽最大努力使其格式良好
SCSS还将/
用于丢弃的注释
特别是,SCS解释/**/
中的插值表达式({..}
)。如果将$sm xx
定义放入/
样式注释中,则将编译该文件。(请注意,您不能嵌套注释。/
行必须位于/***/
块之外。)SCS具有:
[SCSS]支持带有/***/
的标准多行CSS注释,这些注释尽可能保留在输出中。这些评论可以有任何你喜欢的格式;Sass将尽最大努力使其格式良好
SCSS还将/
用于丢弃的注释
特别是,SCS解释/**/
中的插值表达式({..}
)。如果将$sm xx
定义放入/
样式注释中,则将编译该文件。(请注意,您不能嵌套注释。/
行必须位于/***/
块之外。)解释
Sass支持带/**/的标准多行CSS注释,以及带//的单行注释。如果可能,多行注释将保留在CSS输出中,而单行注释将被删除。例如:
/* This comment is
* several lines long.
* since it uses the CSS comment syntax,
* it will appear in the CSS output. */
body { color: black; }
// These comments are only one line long each.
// They won't appear in the CSS output,
// since they use the single-line comment syntax.
a { color: green; }
汇编为:
/* This comment is
* several lines long.
* since it uses the CSS comment syntax,
* it will appear in the CSS output. */
body {
color: black; }
a {
color: green; }
/* This CSS is generated by My Snazzy Framework version 1.2.3. */
另一个例子
$version: "1.2.3";
/* This CSS is generated by My Snazzy Framework version #{$version}. */
汇编为:
/* This comment is
* several lines long.
* since it uses the CSS comment syntax,
* it will appear in the CSS output. */
body {
color: black; }
a {
color: green; }
/* This CSS is generated by My Snazzy Framework version 1.2.3. */
资料来源:
答复
这就是它试图解析/***/
中的变量并给出错误的原因。要避免这种情况,请改用/
。解释
Sass支持带/**/的标准多行CSS注释,以及带//的单行注释。如果可能,多行注释将保留在CSS输出中,而单行注释将被删除。例如:
/* This comment is
* several lines long.
* since it uses the CSS comment syntax,
* it will appear in the CSS output. */
body { color: black; }
// These comments are only one line long each.
// They won't appear in the CSS output,
// since they use the single-line comment syntax.
a { color: green; }
汇编为:
/* This comment is
* several lines long.
* since it uses the CSS comment syntax,
* it will appear in the CSS output. */
body {
color: black; }
a {
color: green; }
/* This CSS is generated by My Snazzy Framework version 1.2.3. */
另一个例子
$version: "1.2.3";
/* This CSS is generated by My Snazzy Framework version #{$version}. */
汇编为:
/* This comment is
* several lines long.
* since it uses the CSS comment syntax,
* it will appear in the CSS output. */
body {
color: black; }
a {
color: green; }
/* This CSS is generated by My Snazzy Framework version 1.2.3. */
资料来源:
答复
这就是它试图解析/***/
中的变量并给出错误的原因。为了避免这种情况,请改用/
。您能告诉我们错误和相关注释吗?好的,只是在我的问题中添加了它!您确定问题出在注释语法上,而不是错误所说的$sm breakpoint
变量上吗?$sm breakpoint变量确实未定义。但如果评论中提到了这一点,这又是一个什么问题呢?这里有点不对劲。评论中的内容不会触发错误。至少我以前从未见过这样的事情。你能告诉我们错误和相关的评论吗?好的,只是在我的问题中添加了它!您确定问题出在注释语法上,而不是错误所说的$sm breakpoint
变量上吗?$sm breakpoint变量确实未定义。但如果评论中提到了这一点,这又是一个什么问题呢?这里有点不对劲。评论中的内容不会触发错误。至少我以前从未见过这样的事情。