krasimir / cssx

CSS in JavaScript
http://krasimir.github.io/cssx/
MIT License
1.01k stars 35 forks source link

Loader for independent files. #21

Open zvictor opened 8 years ago

zvictor commented 8 years ago

I have a setup where I add my styling as independent .cssx files. It works well with the meteor quadric:cssx plugin, but now I need to add integration with my storybook.

I couldn't find anywhere in the docs or examples a way to config webpack to load .cssx files instead of .js(x). I tried many ways, in different orders, but I can't get rid of the following error:

ERROR in ./myProject/myComponent.cssx
Module parse failed: /absolutePath/myProject/myComponent.cssx Unexpected token (2:2)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (2:2)

Could someone add an example with independent .cssx files? Preferably using storybook?

krasimir commented 8 years ago

Is it an option to create a.js file that exports something like:

export default <style>
... your styles here ...
</style>;