Home

Awesome

<p align="center"> <img src="https://github.com/Bjorn-Strom/FSS/raw/master/logo.png" width="150px" /> <h1 align="center">Fss</h1> </p>

Build Status Tests GitHub license

Fss is a dependency free CSS library for dotnet that provides statically typed styling for your projects and aims to cover a huge part of the CSS spec.

It gives you CSS as a first class citizen in your projects and was made to be predictable and easy to use.

Fss gives you the option to generate styles at runtime or to ouptut into CSS files.

Documentation 📖

Examples 🤓

Quick Elmish example here, check the documentation for more information.

let buttonStyle =
    fss
        [
            BackgroundColor.hex "44c767"
            BorderRadius.value (px 30)
            BorderWidth.value (px 1)
            BorderStyle.solid
            BorderColor.hex "18ab29"
            Display.inlineBlock
            Cursor.pointer
            FontSize.value (px 17)
            Hover
                [
                    BackgroundColor.hex "5cbf2a"
                ]
        ]
button [ ClassName buttonStyle ] [ str "Click me" ]

You can also check out this sample repo: samples.

Installation 💾

Install the Nuget package you need. If you are using Fable or Feliz then you probably want Fss.Fable or Fss.Feliz. If you are using Giraffe then you probably want Fss.Giraffe, and if you are using Falco then you probably want Fss.Falco. Doing something custom or extending Fss? Then you probably want Fss.Core.

PackageNuGetDownloads
Fss.Core NugetNuget
Fss.FableNugetNuget
Fss.FelizNugetNuget
Fss.GiraffeNugetNuget
Fss.FalcoNugetNuget
Fss.StaticNugetNuget
Fss.BuilderNugetNuget

To install Fss you need to install the nuget package.

# nuget
dotnet add package Fss-lib.<YourLibraryOfChoice>
// For example
dotnet add package Fss-lib.Fable

Motivation 🏁

When it comes to styling in F# you do have some good alternatives for styling:

There is however no good solution to writing CSS purely in F#, CSS-in-Fs if you will, and this library aims to do just that. If you wish to write your own CSS and you are using dotnet, Fss is the best solution for just that.

The primary goal of this project is to have an easy way to write type-safe discoverable styling with F# that supports most of the CSS spec. It was also important to me that it works independently of any other frameworks and would work anywhere you can run F# code. Therefore you can use Fss with Fable, Giraffe or any other solution you can think of.

Major goals of Fss

Features 🛠

See the Documentation for more information

Who is it for? 😎

Fss is intended for developers who want to write their own CSS using F#. If you have an existing stylesheet Fss does nothing for you, (unless you want to rewrite it), in that case you might want to check out TypedCssClasses. If you do not want to write your own CSS but you want to have some prebuilt stylesheet then something like Fulma might be what you are looking for. IF however you wish to write your own CSS in a type safe way, then Fss is what you want to use.

Contribution 🔨

The best way to contribute to Fss is to use it! 😎 The more it is used the more tested it gets. If you do find any missing or bugged CSS properties, or maybe you are missing a framework library, feel free make an issue or PR. If you have some cool samples or examples feel free to to contribute to the documentation. In short, any and all contributions are very welcome.