Olive CSS: A Lisp-Powered Alternative to Tailwind CSS for the Freedom-Conscious Developer
#Dev

Olive CSS: A Lisp-Powered Alternative to Tailwind CSS for the Freedom-Conscious Developer

Tech Essays Reporter
6 min read

Olive CSS offers a unique approach to utility-first CSS frameworks by leveraging Guile Scheme to create a customizable, hackable alternative to Tailwind CSS. This article explores the technical implementation, philosophy, and practical implications of this free software project.

In the ever-evolving landscape of web development, utility-first CSS frameworks have become increasingly popular for their ability to rapidly prototype and style applications without writing custom CSS. Among these, Tailwind CSS has emerged as the dominant player, with its utility-first approach and extensive ecosystem. However, for developers seeking more control, transparency, and freedom in their tools, Olive CSS presents an intriguing alternative.

Olive CSS is a utility-class vanilla CSS framework that draws inspiration from Tailwind's syntax while being implemented entirely in Guile Scheme, a dialect of the Lisp programming language. This fundamental difference in implementation philosophy creates a framework that is not functionally similar to Tailwind, but conceptually aligned with its utility-first approach.

Featured image

Technical Implementation: The Power of Scheme

What sets Olive CSS apart from its JavaScript-based counterparts is its implementation in Guile Scheme. This choice is not merely a technical curiosity but reflects a deeper commitment to certain values. The Scheme codebase allows for metaprogramming capabilities that would be difficult or impossible to achieve in JavaScript.

The framework generates CSS through Scheme scripts, which can be found in the src/olive-css directory. This approach offers several advantages:

  1. Expressive customization: Using Scheme's powerful parameterize syntax, developers can override virtually any aspect of the framework during build time.
  2. Programmatic generation: CSS classes are generated programmatically, allowing for complex logic and transformations that would be cumbersome in a traditional CSS configuration.
  3. Deterministic builds: The Scheme-based build process produces consistent, reproducible CSS output without the unpredictability sometimes associated with JavaScript-based build tools.

The scripts/olive-css-gen.scm file serves as the entry point for generating custom CSS builds, demonstrating how the framework can be tailored to specific project requirements.

Philosophy: Beyond Another Tailwind Clone

The creators of Olive CSS explicitly position it as "not another Tailwind clone" but rather a project inspired by Tailwind's utility-first approach while embodying different principles. The project's philosophy is built on four core pillars:

  1. Hackability: The framework is designed to be extended and modified through Scheme code, allowing developers to customize virtually any aspect of the generated CSS.
  2. Freedom: As 100% Free Software under LGPLv3+ and FDL 1.3+, Olive CSS respects user freedom in a way that Tailwind CSS, with its MIT license, does not.
  3. Self-containment: The framework aims for minimal dependencies and fast build times, avoiding the complex tooling chains that often accompany modern web development.
  4. Expressiveness: The framework is built to support adding any CSS feature through custom palettes and rules, encouraging learning rather than hiding complexity.

This philosophy reflects a different approach to web tooling—one that prioritizes transparency, user control, and the free software movement over convenience and market dominance.

Installation and Customization: Tailoring the Framework

Installing Olive CSS is straightforward, with pre-built CSS files available in the resources/css directory. However, the true power of the framework emerges during customization.

Unlike Tailwind's configuration files, Olive CSS customization happens through Scheme code, offering a different kind of flexibility. Key customization points include:

  • Selecting which screen breakpoints to include (sm, md, lg, xl, 2xl)
  • Enabling or disabling dark mode
  • Customizing the color palette
  • Generating custom responsive or hover-based variants

The framework addresses a common concern with utility-first frameworks: CSS bundle size. By allowing developers to precisely control what gets included in the generated CSS, Olive CSS enables creating highly optimized production stylesheets. The documentation wisely recommends disabling unused breakpoints and colors to reduce bundle size, a practice made easy through Scheme's expressive syntax.

Comparison with Tailwind CSS

The project includes a thoughtful comparison with Tailwind CSS that highlights key differences:

Feature Tailwind CSS Olive CSS
Written in JavaScript Guile Scheme
Customization Average (via CSS config) Extensive (via code and expressive DSL)
Functional API No Yes
Free Software No (MIT, not copyleft) Yes (LGPL v3 + FDL)
Output control Limited, JIT compiler restricting Full (generate exactly what you want)

These differences reveal a fundamental divergence in approach. While Tailwind CSS prioritizes developer experience and market adoption, Olive CSS emphasizes user freedom and technical transparency. The functional API in Olive CSS, for example, enables programmatic generation of CSS in ways that would be difficult in Tailwind's JavaScript-based system.

Practical Applications and Use Cases

Olive CSS is particularly well-suited for several scenarios:

  1. Freedom-conscious projects: For organizations and developers committed to free software, Olive CSS provides a utility-first framework that respects these values.
  2. Custom UI systems: When building highly customized design systems, the Scheme-based approach allows for precise control over generated CSS.
  3. Educational contexts: The transparent, code-based approach makes Olive CSS an excellent tool for learning CSS and the relationship between code and styles.
  4. Performance-critical applications: The ability to generate highly optimized CSS without unused classes can lead to performance benefits.

Several projects already use Olive CSS, including Hygguile, LucidPlan, WikiMusic, Iter Vitae, and Byggsteg, demonstrating its practical applicability across different domains.

Challenges and Limitations

Despite its strengths, Olive CSS faces several challenges:

  1. Learning curve: Developers unfamiliar with Scheme will need to learn a new paradigm for customizing their CSS, which presents a steeper initial learning curve than Tailwind's configuration approach.
  2. Ecosystem maturity: As a smaller project, Olive CSS lacks the extensive ecosystem of plugins, components, and community resources that Tailwind CSS has developed.
  3. Tooling integration: Integrating a Scheme-based CSS generator into existing JavaScript-based toolchains may require additional configuration.
  4. Documentation: While the project includes documentation, the Scheme-based approach may require more technical documentation to be accessible to a broader audience.

Conclusion: A Different Path for Web Tooling

Olive CSS represents an important alternative in the CSS framework landscape. It demonstrates that utility-first CSS can be implemented in different ways, with different values and priorities. For developers who value freedom, transparency, and hackability in their tools, Olive CSS offers a compelling option.

The project's significance extends beyond its technical features. It embodies a different philosophy for web development—one that questions the dominance of JavaScript in all aspects of frontend tooling and explores what's possible with different programming paradigms.

As the web development community continues to evolve, projects like Olive CSS remind us that there are always alternative approaches to solving problems. Whether Olive CSS will gain widespread adoption remains to be seen, but it has already proven that a Lisp-based CSS framework is not only possible but practical and well-designed.

For developers interested in exploring Olive CSS further, the official documentation and API documentation provide comprehensive information on getting started and customizing the framework. The project's open nature and welcoming community make it an excellent choice for those looking to contribute to free software web tooling.

Comments

Loading comments...