Skip to content
Gabriel Scatolin edited this page Sep 25, 2023 · 3 revisions

Simple CSS Compiler (XCSS) is an pre-processor for the CSS styling language.

This small module can compile CSS with the following features into a legacy CSS file that is more compatible with most browsers.

It can compile CSS with nesting and single-line comments into legacy CSS code, also minifies it.

It can compile:

@import url("https://foo.bar/");

div {
    display: block;
    width: 400px; // it does support comments
    /* native multi-line comments too */

    height: 300px;

    > a {
        align-self: center;

        & :hover {
            color: red;
        }
    }

    & .test {
        font-size: 20px;
    }
}

@media (max-width: 700px) {
    div.test {
        width: 100%;
    }
}

Into:

@import url("https://foo.bar/");

div {
    display: block;
    width: 400px;
    height: 300px
}

div.test {
    font-size: 20px
}

div > a {
    align-self: center
}

div > a:hover {
    color: red
}

@media (max-width: 700px) {
    div.test {
        width: 100%
    }
}

Only with:

string css = SimpleCSS.SimpleCSSCompiler.Compile(prettyCss);

It's an drop-in alternative to SCSS/LESS you can use with .NET or any other project.

Clone this wiki locally