You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Divi WP子主题开发时Style.css莫名变为单行的解决问询

解决Sublime Text 2编辑style.css后变为单行的问题

Hey, let's figure out why your Divi child theme's style.css is turning into a single line after editing in Sublime Text 2. I’ve dealt with odd editor quirks like this before, so here’s what you can try to fix it for good:

  • 排查隐藏的压缩/格式化插件
    Even if you don’t remember enabling a compression plugin, some lesser-known formatting tools (like CSScomb, Minify, or even a rogue formatter) might have been activated accidentally. Open Sublime’s Preferences > Package Control > Package Control: List Packages, search for any packages with "minify", "compress", or "format" in their names. Disable them temporarily, then edit and save your style.css again to see if the issue goes away.

  • 检查换行符格式
    Incorrect line endings can sometimes make files appear as a single line in editors or browsers. Look at the bottom-right status bar in Sublime Text 2—it’ll show the current line ending type (like Windows (CRLF) or Unix (LF)). Click on it to switch to the opposite format, save the file, and reload your site to test.

  • 审查Sublime的自动格式化设置
    Head to Preferences > Settings - User and check for any lines like "auto_format_on_save": true or CSS-specific compression rules. If you find any, set them to false or delete the lines entirely. Save your settings, restart Sublime, and try editing the CSS file again.

  • 验证服务器端文件状态
    Even if you don’t have a compression plugin, some web hosts enable automatic static file compression (like Gzip) by default. But this usually only affects file transfer, not the original file. Log into your server and check the raw style.css file—if it’s still single-line there, the problem is definitely local to your editor. If it’s normal on the server, clear your browser cache and reload the page.

  • 尝试升级或更换编辑器
    Sublime Text 2 is pretty outdated at this point, and it might have bugs with modern CSS files or theme compatibility. If none of the above fixes work, try upgrading to Sublime Text 4, or temporarily use another editor like VS Code or Atom to edit your style.css. If the problem doesn’t happen in another editor, you’ll know it’s a Sublime Text 2-specific issue.

  • 强制设置CSS语法关联
    Sometimes Sublime might misclassify your style.css file (e.g., as plain text), which can trigger unexpected formatting. Open the file, click the syntax label in the bottom-right corner (if it doesn’t say CSS), select CSS from the dropdown, save the file, and reload.


内容的提问来源于stack exchange,提问作者tangobango

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 09:51:06