Import css / style files to .elm files with or without webpack

Can css / sass / stylus files be directly imported into Elm files? The webpack css-loader module makes this possible in Javascript with import './styles.css' , but I cannot find anything about how this can be done in Elm with or without Webpack.

+5
source share
2 answers

I had the same question when I started learning styles, and I ended up creating POC what it might look like using the Elm port and subscriptions to tell Webpack about the extraction of CSS modules.

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

+3
source

I donโ€™t think it can be done directly, but you can create an entry point for the bridge for Webpack, which will import everything, including CSS and Elm together, for binding.

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

+2
source

Source: https://habr.com/ru/post/1246335/


All Articles