Skip to content

ahstro/elm-bulma-classes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

A simple library for using the Bulma CSS library classes. It's simply a module exposing all classes at top level, putting the burden of not making typos on the compiler. Nothing fancy.

Usage

Example usage:

import Html
import Html.Attributes as Attributes
import Bulma.Classes as Bulma

view =
    Html.div
        [ Attributes.class Bulma.columns ]
        [ Html.div
            [ Attributes.class Bulma.column ]
            [ Html.text "column 1" ]
        , Html.div
            [ Attributes.class Bulma.column ]
            [ Html.text "column 2" ]
        ]

Why?

"Why? There's already a bunch of Bulma libraries" you might say, and that is a valid question. Well, as of writing there are three other Elm libraries with bulma in their name - surprisetalk/elm-bulma, jmackie4/elm-bulma, and danielnarey/elm-bulma-classes.

jmackie4/elm-bulma says it's a WIP in the readme, and the GitHub repo no longer exists, so we can safely disregard that.

surprisetalk/elm-bulma seems both active and useful, but ultimately tries to achieve a different goal than this library by providing an entire framework for using Bulma (check it out, seems pretty darn cool).

The one that's most like (and an inspiration for) this library is danielnarey/elm-bulma-classes. The core difference is that danielnarey/elm-bulma-classes exposes a single record containing a nested structure that ultimately branches out into all available classes. This structure (probably) works pretty well if you've got a (semi-)sophisticated code completion setup, but since I don't, I had to constantly look up which branches in the source code to get the class name I knew I wanted; with this library, I'm replacing some of the safety of grouping related classes with ease-of-use by exposing them all at the top level, essentially just letting the Elm compiler check my typos. Also, unfortunately, Daniel's library has been deprecated and not been updated since Bulma 0.4.2. This flatter structure should hopefully make it a lot easier to keep up-to-date.