Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Importing css/style files in .elm files with (or without) webpack

Tags:

css

styling

elm

Can css/sass/stylus files be directly imported into Elm files in some way? The webpack css-loader module makes this possible in Javascript with an import './styles.css', but I can't find anything on how one might do it in Elm with or without Webpack.

like image 641
neurodynamic Avatar asked Apr 03 '16 13:04

neurodynamic


2 Answers

I had the same question when I started looking into styles and I ended up making a POC of how that might look like by using Elm port and subscriptions to tell Webpack to fetch CSS modules.

Check it out: https://github.com/geekyme/elm-css-modules

like image 115
unclelim12 Avatar answered Nov 15 '22 04:11

unclelim12


I don't think this can be done directly, but you can create a bridging entry point for Webpack that will import everything, including CSS and Elm together, for bundling.

Check this out: http://www.elm-tutorial.org/050_starting/webpack.html#indexjs

like image 26
BHouwens Avatar answered Nov 15 '22 03:11

BHouwens