Skip to content

Provides a CSS compiler that compiles higher-level code with single-line comments, nesting into a legacy CSS file.

License

Notifications You must be signed in to change notification settings

CypherPotato/cascadium

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cascadium

Cascadium is a lightweight CSS preprocessor for CSS.

This small project can compile CSS with superpowers into a flat CSS file that is more compatible with a larger number of browsers. The project was written in C# and can run on any operating system without the installation of .NET.

Cascadium, unlike other preprocessors, tends to be an extension of CSS and not another markup or programming language. It has some developer-specific features, but all of them are focused on still being "CSS."

Main features:

  • Convert nested CSS into flat CSS
  • Single-line comments
  • Minification, compression, and merging of CSS files
  • Custom property converters
  • Rewrite media queries

Installing

Install Cascadium with NPM:

npm install -g @cypherpotato/cascadium

And then, just run it from the command line:

cascadium

1. Table of Contents

2. Getting Started

You can use the library in your C# project or use the command-line tool compatible with any type of project.

To use the library in your code, you can start by adding the reference to Cascadium:

dotnet add package Cascadium.Compiler

And use it as in the example below:

static void Main(string[] args)
{
    string xcss = """
        div {
            color: red;

            > span {
                color: blue;
                font-weight: 500;
            }
        }
        """;

    var stylesheet = CascadiumCompiler.Parse(xcss);
    var css = stylesheet.Export();

    Console.WriteLine(css);
}

And get the result:

div{color:red}div>span{color:blue;font-weight:500}

Documentation

3. Introduction

The goal of Cascadium is to be as faithful to the original CSS as possible. Therefore, you will not find a similar experience to what SASS or LESS offers: there will be no preprocessor variables, no mixins, loops, etc. Cascadium should be seen as an extension of CSS, not as a language like SASS or LESS.

Creating entire projects with SCSS is possible, with pure CSS as well, so it will be with Cascadium too. The main advantage of Cascadium is being flexible enough to be integrated into any type of project, as its generator can produce CSS files equivalent to the typed Cascadium code.

Currently, Cascadium can be used in two ways:

  • CLI: through the Cascadium tool binaries, which allows usage in any project of any programming language.
  • .NET Package: the .NET library of Cascadium, which allows the use of the compiler in a managed development environment.

For detailed information about syntax, compiler settings, CLI configuration, and converters, please refer to the Cascadium Specification.

About

Provides a CSS compiler that compiles higher-level code with single-line comments, nesting into a legacy CSS file.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •