Olive CSS:Lisp 驱动的、类似 Tailwind 的原生 CSS 工具类
Olive CSS: Lisp powered vanilla CSS utility-Class A la Tailwind

原始链接: https://codeberg.org/jjba23/olive-css

Olive CSS 可以通过下载预构建文件或生成自定义构建轻松实现。然而,默认的 `olive.min.css` 由于其全面的类库而相当大。**对于生产环境,强烈建议创建自定义构建**以优化包大小。 关键的减小体积策略包括禁用未使用的屏幕断点(如 `xl` 或 `2xl`)以及仅选择项目所需的颜色。禁用深色模式也能显著节省空间。自定义功能由 Guile Scheme 提供支持,可以对功能、大小和颜色进行广泛控制。 你可以通过选择断点、切换深色模式和定义颜色调色板来定制 Olive CSS。高级用户甚至可以创建自定义的响应式和悬停变体。详细的定制说明和 API 可在 `scripts/olive-css-gen.scm` 和 `src/olive-css/main.scm` 中找到。请记住利用 Web 服务器缓存和压缩(GZIP/Brotli)以获得最佳性能。

Olive CSS: Lisp 驱动的纯 CSS 工具类,类似 Tailwind (codeberg.org/jjba23) 5 分,由 jjba23 发布 43 分钟前 | 隐藏 | 过去 | 收藏 | 1 条评论 帮助 VPenkov 10 分钟前 [–] 比较部分说 MIT 许可证不是“自由的”,因为它不是 copyleft。为什么更宽松的许可被认为更不自由?回复 考虑申请 YC 2026 夏季批次!申请截止至 5 月 4 日 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

Installing and using Olive CSS is as simple as downloading a pre-built version from resources/css/ directory, or building your own, and serving it via HTTP (of course also loading it in a <link> tag in your HTML.

About bundle size: Keep in mind that the default olive.min.css is pretty large, since it contains all classes and variants and media queries of classes. It is recommended before going to production, to create your own custom optimized build of Olive CSS, by disabling certain features.

Some factors that can drastically affect the size of the production CSS style sheet are the amount of colors you enable and amount of media queries/breakpoints.

A rule of thumb is to disable xl and/or 2xl queries if you won't use them, and only choose some colors. This is made easy thanks to Guile Scheme's powerful parameterize syntax and helpers, allowing you to override pretty much anything. It can also be useful to disable dark mode since that will save a lot of complexity. See scripts/olive-css-gen.scm for more.

It's also important to ensure that your web server efficiently caches CSS files and compresses them with GZIP or Brotli.

Customizing Olive CSS

Customization is a first-class feature in Olive CSS. Thanks to the power of Guile Scheme, you can enable/disable features, tweak sizes, colors, and easily add your own utility rules.

Key customization points:

  • Choose which screen breakpoints to include (sm, md, lg, xl, 2xl)
  • Enable or disable dark mode with parameterize
  • Customize your color palette and choose some colors for your project

You can also generate your own responsive or hover-based variants with addmq and addhover

See scripts/olive-css-gen.scm and src/olive-css/main.scm and the API docs for more.


联系我们 contact @ memedata.com