GithubHelp home page GithubHelp logo

elm-css-modules's Introduction

What is this?

This project shows how you could use webpack's css-modules in Elm's development. This is an alternative approach as compared to elm-css, which is a more functional and pure approach towards declaring component styles.

This is not meant to be set-in-stone truth, but rather a proof-of-concept. Try it and adapt it to your needs!

Benefits of this approach

  • CSS Modules: Dynamically generated locally scoped namespaces for classes. 100% compatibility with doing animations / pseudo selectors and media queries, anything you could do with css. Use all the tooling developed on top of CSS like autoprefixer.

  • Interop with existing projects: Projects using webpack + css modules could easily port all styles into Elm using this approach.

How?

CSS modules get loaded into Elm via ports and subscriptions. See fetchClasses and receiveClasses and example usage in Login.elm. Webpack receives commands from elm and loads the css modules here. This goes through the Elm Architecture in the application and the css modules will eventually reach the component that needs it.

Requirements

  • Node 6.x.x

  • Elm 0.17.0

Installation

  1. elm package install

  2. npm install

Development

  • npm start

elm-css-modules's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.