【问题标题】:Sass compressed output removing loud commentSass 压缩输出消除了嘈杂的评论
【发布时间】:2023-03-19 00:18:02
【问题描述】:

好的,所以我正在开发一个 Wordpress 主题,并且我正在使用 Sass 和 Grunt。问题是,虽然在我的主 SCSS 文件中我有这样的大声评论,但压缩输出仍然不包含它。

/*!
Theme Name:         Theme Name
Theme URI:          http://theme.com
Description:        Theme Description.
Version:            1.0.0
Author:             Me
Author URI:         http://me.com
*/

/* Global config */
@import "config/variables"; // Your custom variables
@import "config/colors"; // Your custom color scheme
@import "config/settings"; // Default settings file. Uncomment each setting you need to change

/* Foundation 5 */
@import "foundation"; // Foundation 5 by Zurb

/* Site structure */
@import "site/structure"; // Your site structure

我尝试将 outputStyle 更改为嵌套在 Gruntfile 中,并且 cmets 以这种方式显示,但显然我不想在实时站点上这样做。知道是什么原因造成的吗?

编辑:这是我正在使用的主题https://github.com/olefredrik/foundationpress/

【问题讨论】:

  • 你确定其他东西没有剥离它吗?相关:stackoverflow.com/questions/4893215/…
  • 我不知道发生了什么,如果有其他东西正在剥离它,我应该去哪里看?在发布之前,我阅读了您链接的问题和许多其他内容,但我仍然不知道问题是什么。我是 Sass 的新手,但这是我第一次与 Grunt 合作,所以这可能是一些愚蠢的小事。另外,这是我正在研究的主题,以防万一:github.com/olefredrik/foundationpress
  • 当你自己输入grunt sass时,生成的.css文件是什么样子的?
  • 我刚试过,得到完全相同的输出。压缩后,完全没有 cmets。
  • 你试过在 Grunt 之外编译 Sass 吗?

标签: sass gruntjs


【解决方案1】:

使用!,无论您要编译成何种输出样式(nested, expanded, compact or compressed),都应该保留您的多行 cmets。因此,Sass 编译之外的某些东西必须剥离 cmets - 可能在 Grunt 编译中的某个地方。

【讨论】:

    猜你喜欢
    • 2013-07-23
    • 2019-04-27
    • 1970-01-01
    • 1970-01-01
    • 2014-07-28
    • 2021-08-18
    • 2014-08-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多