-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Packing CSS images #37
Comments
Do you why is this? What's the normal webpack config we used when doing this? I am pretty new to webpack. So, any help would be great. |
Unfotunatelly I'm not a webpack master. @eXon, would you be able to shed some light on this please? What is needed to be done to serve static assets from webpack? |
Hi @tomitrescak I just had the same issue, I fixed it by specifying a static directory. So you can run
in this example
and I changed my package.json scripts block to
See here https://github.com/kadirahq/react-storybook/blob/master/docs/api.md#static-directory |
@stewartduffy that is great! Woulf you be please so kind and post the whole webpack configuration file? Thanks!! |
Hi @tomitrescak sorry about the delayed response. So I currently have 2 webpack configs - one at the root dir & one in .storybook:
And my root
The reason for 2 configs is at the time, storybook didn't allow for anything in |
Did this help? |
@tomitrescak The following config is working fine for me to load fonts and images. Might be helpful. const path = require('path');
module.exports = {
module: {
loaders: [
{
test : /\.scss$/,
loaders: ["style", "css", "sass"],
include: path.resolve(__dirname, '../')
},
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "url-loader?limit=10000&mimetype=application/font-woff"
},
{
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "file-loader"
}
]
}
}; |
Works for me as well, thanks guys! Amazing stuff. |
Guys, sorry to ask this here, but you seem to have much better understanding of webpack than me. I have a problem when storybook is not loading icons.woff and icons.tts from semantic ui. The framework is trying to load them from "themes/default/assets" directory. How can I mount assets to storybooks webpack so that they are then served from the correct url? Maybe webapck can even parce css and serve these files automatically? Not sure here .... |
@tomitrescak were you able to load the fonts that come with semantic-ui with storybook? I'm having issue with the fonts and icons that semantic ui uses. See image. |
The only way to go is to copy icons and all other required file to the asset directory which you configure when you run storybook. Copy the files into the "default" directory (see where sui is trying to load it from). Then configure loaders as above. And you are done. |
@tomitrescak @purplecones there could be more than one static directories. You can pass them to storybook
picked this info from #229 |
@roonyh I have this
but it still does not load the assets
@tomitrescak I also wasn't able to get the fonts to load by copying them to the 'default' folder in the |
@purplecones That config will make the fonts available at root. At url What you probably should do is giving
This will make them available at |
@roonyh that did it. Thanks for that insight! |
Also just for future references, you can also put the |
Custom query params are not stored in a separate object
Test regex for the whole path instead of just the filename
Fix typo - Button should be button
Include dot files in auto deploy so that travis doesn't build master
Now that the |
|
use onboarding parameter in conjunction with onboarding path
When there is an image or a font embedded in the CSS, it is not loaded in the storybook. I tried adding
but this only solves the resolution of the file, yet it is not loade from the correct URL. For example this fails for icon files in semantic ui and bootstrap:
The text was updated successfully, but these errors were encountered: