Skip to content
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

Add option to specify path where all files from static directories will be outputted #1685

Closed
srghma opened this issue Aug 18, 2017 · 7 comments

Comments

@srghma
Copy link

srghma commented Aug 18, 2017

Right now I have nextjs project, with images in /static/images folder, and Im using it in components like this

<img src="/static/images/logo.png" alt="logo" />
Problem is when I starting storybook with "storybook": "start-storybook -p 6006 -c app/.storybook -s static", the logo cant be found, for storybook proper path to image is now "/images/logo.png"

@jonespen
Copy link

jonespen commented Oct 16, 2017

Had the exact same issue, added the file middleware.js to ./storybook with this content:

const express = require('express')
const path = require('path')

module.exports = router => {
  router.use('/static', express.static(path.join(__dirname, '..', 'static')))
}

Hope it helps!

Inspired by #714

@srghma
Copy link
Author

srghma commented Oct 16, 2017

Thanks @jonespen 👍

@Hypnosphi
Copy link
Member

@ndelangen is this middleware feature documented anyhow?

@ndelangen
Copy link
Member

I'm afraid it's not @Hypnosphi

Thing to know about it is: it doesn't work when building a static version of storybook.

@stale
Copy link

stale bot commented Dec 8, 2017

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 60 days. Thanks!

@aviramga
Copy link

aviramga commented Feb 9, 2018

@ndelangen @jonespen Im having the exact same issue but with build-storybook. Im also using nextjs. How can I solve this?

Thanks!

@Hypnosphi
Copy link
Member

Duplicates #714

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants