CSS 整洁配置

发布于 2024-07-09 15:09:01 字数 1200 浏览 6 评论 0原文

我正在使用 CSS Tidy。 由于其所有压缩措施,在某些情况下,它会通过组合或重新排列选择器等来弄乱我的页面。即使使用下面显示的选项,具有压缩 CSS 的页面也不会像未压缩的那样呈现。

我的问题是:如何配置 CSS Tidy 将所有 CSS 文件合并为一个,并且仅此而已?

$this->settings['remove_bslash'] = false;
$this->settings['compress_colors'] = false;
$this->settings['compress_font-weight'] = false;
$this->settings['lowercase_s'] = false;
$this->settings['optimise_shorthands'] = 0;
$this->settings['remove_last_;'] = false;
$this->settings['case_properties'] = 0;
$this->settings['sort_properties'] = false;
$this->settings['sort_selectors'] = false;
$this->settings['merge_selectors'] = 0;
$this->settings['discard_invalid_properties'] = false;
$this->settings['css_level'] = 'CSS2.1';
$this->settings['preserve_css'] = true;
$this->settings['timestamp'] = false;

@ypnos:在配置方面,我没有配置文件,在初始化类时没有设置配置选项。 我刚刚在实际类中编辑了 csstidy() 函数。 我确信我编辑的设置正在被读取,因为一些(但不是几乎全部)问题已得到解决。

@Ambrose:CSS 压缩为 30k,并且存在许多我难以追踪的问题。 我可以清楚地看到渲染页面上的问题,但在 CSS Tidy 生成的文件中更难追踪它们。 在某些情况下,选择器的顺序被更改,但通过编辑这些设置,我至少纠正了该问题。 您关于 CSS Tidy 的两个假设(URL 和 PHP 的用法)都是正确的。

由于 http 压缩可以从空白的角度压缩 CSS,因此我需要 CSS Tidy 做的就是将所有 CSS 文件合并为一个,而不尝试操作内容。

I am using CSS Tidy. Due to all of its compression measures, in some cases it's messing up my pages by combining or re-arranging selectors, etc. Even with the options shown below, pages with the compressed CSS do not render as they do with the uncompressed.

My question is: How can I configure CSS Tidy to combine all of my CSS files into one, and do nothing more than that?

$this->settings['remove_bslash'] = false;
$this->settings['compress_colors'] = false;
$this->settings['compress_font-weight'] = false;
$this->settings['lowercase_s'] = false;
$this->settings['optimise_shorthands'] = 0;
$this->settings['remove_last_;'] = false;
$this->settings['case_properties'] = 0;
$this->settings['sort_properties'] = false;
$this->settings['sort_selectors'] = false;
$this->settings['merge_selectors'] = 0;
$this->settings['discard_invalid_properties'] = false;
$this->settings['css_level'] = 'CSS2.1';
$this->settings['preserve_css'] = true;
$this->settings['timestamp'] = false;

@ypnos: In terms of configuration, I do not have a configuration file, no do I set the configuration options when I initialize the class. I just edited the csstidy() function in the actual class. I am sure my edited settings are being read because some—-but not nearly all--of the problems were fixed.

@Ambrose: The CSS is 30k compressed and has a number of issues I am having difficulty in tracking down. I can clearly see problems on the rendered pages, but tougher to track them down in the file generated by CSS Tidy. In some cases, the order of selectors was being changed, but by editing those settings, I at least corrected that problem. Both of your assumptions about CSS Tidy (URL and usage as PHP) are correct.

Since http-compression can compress the CSS from a whitespace standpoint, all I need CSS Tidy to do is combine all of my CSS files into one, without trying to manipulate the contents.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

娇柔作态 2024-07-16 15:09:01

您向我们展示一下您的 CSS 之前和之后怎么样?

链接到 CSS Tidy 本身怎么样? 我认为是这个? 被用作 PHP 脚本?

How about you show us a before and after of your CSS?

And how about you link to CSS Tidy itself? I assume it's this? Being used as a PHP script?

柒七 2024-07-16 15:09:01

我能够找到问题的根源。 我错误地将其归因于 CSS Tidy,而实际上是其他原因造成的。 谢谢您的帮助。

I was able to track down the source of my problem. I had incorrectly attributed it to CSS Tidy, when something else was actually at fault. Thanks for the help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文