zillow / create-react-styleguide

A toolkit for creating React component libraries and style guides
20 stars 6 forks source link

Webpack config for importing external CSS/Images/Fonts #8

Open jeffscottward opened 6 years ago

jeffscottward commented 6 years ago

Currently when building my own style-guide, generated as described in the readme, I am unable to import assets other than javascript.

_ I would like to be able to import css -- Locally sourced CSS (regular) -- Locally sourced CSS file for generated font-face stacks (url sourcing issue?) -- CSS files that are required by NPM-installed React components (rc-slider for example) -- Stylesheets resets that are installed via NPM (like sanitize.css) --^ same issue I believe

I would like to be able to import images -- to source as src of an img tag -- to use as a background-image for inline CSS (styled-jsx / styled-components)

I would like to be able to import font faces(?) -- to be referenced by a CSS stylesheet I have generated from a font-face generator(!) -- to be required inside of the CSS file in the url param(??? - maybe not) -- [OTHER USE?]

stonebk commented 6 years ago

Dealing with other asset types is not something I have tried to tackle yet, but definitely on my list of things to think about. It's important to ask, what does it mean to import a css file or an image when it comes to a component library? Does it mean using style-loader to inject a