Skip to content

Conversation

@neveler
Copy link
Contributor

@neveler neveler commented Dec 29, 2025

引入 SCSS 支持

当前项目使用 CSS 维护 JavaFX 样式,随着样式规模扩大,逐渐暴露出维护成本高、复用能力弱、结构松散等问题。本次 PR 引入 SCSS 作为样式预处理方案,旨在解决现有 CSS 的局限。

scss 在线预览
https://sass-lang.com/playground/

本次 PR 未引入新的样式也未修改旧的样式,理论上 SCSS 编译产生的 CSS 应与主线基本保持一致。

@neveler neveler changed the title 为 JavaFX 引入 SCSS 支持 引入 SCSS 支持 Dec 29, 2025
@neveler neveler marked this pull request as ready for review December 30, 2025 09:27
@Glavo
Copy link
Member

Glavo commented Dec 30, 2025

看起来本 PR 会让 HMCL 在 Linux LoongArch64 平台上无法构建,需要谨慎调查。

@neveler
Copy link
Contributor Author

neveler commented Dec 30, 2025

看起来本 PR 会让 HMCL 在 Linux LoongArch64 平台上无法构建,需要谨慎调查。

若确有必要为 Linux LoongArch64 平台提供构建支持,可考虑使用 sass npm 来完成 scss 文件的编译。

https://github.com/sass/sass

Install Sass

You can install Sass on Windows, Mac, or Linux by downloading the package for your operating system from GitHub and adding it to your PATH. That's all—there are no external dependencies and nothing else you need to install.

If you use Node.js, you can also install Sass using npm by running

npm install -g sass

However, please note that this will install the pure JavaScript implementation of Sass, which runs somewhat slower than the other options listed here. But it has the same interface, so it'll be easy to swap in another implementation later if you need a bit more speed!

@neveler
Copy link
Contributor Author

neveler commented Dec 30, 2025

看起来本 PR 会让 HMCL 在 Linux LoongArch64 平台上无法构建,需要谨慎调查。

在不支持 EmbeddedSass(Dart Sass) 的平台上,现在可以通过设置环境变量或构建参数的方式使用外部命令行工具构建 SASS

@Glavo
Copy link
Member

Glavo commented Jan 3, 2026

我还是感觉把这个导入构建流程不是特别合适。如果可以的话,我希望同时在代码里保留 css 和 scss,仅在开发者修改了 scss 的情况下才需要重建 css。

@neveler
Copy link
Contributor Author

neveler commented Jan 3, 2026

我还是感觉把这个导入构建流程不是特别合适。如果可以的话,我希望同时在代码里保留 css 和 scss,仅在开发者修改了 scss 的情况下才需要重建 css。

现在会在源码编译前计算 scss 文件夹的 sha256 然后比对 _sha256.scss 的内容判断 scss 是否更新,若 scss 未更新则跳过 build css 任务。

贡献者在提交 css/scss 相关变更时应确保:

  1. 不直接修改由 scss 生成 css 文件
  2. 修改 scss 文件的提交应一并包含 _sha256.scss 及其对应的 css 文件

此外可能需要引入一项新的检查流程,用于判断 CSS 文件与 SCSS 文件是否相匹配,以及 SCSS 文件夹的 sha256 是否与 _sha256.scss 文件一致。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants