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

Allow to use a custom layout. #67

Closed
wants to merge 1 commit into from
Closed

Conversation

jide
Copy link
Contributor

@jide jide commented Apr 6, 2016

Allows to use a custom layout.js file from the config folder using webpack alias.

@@ -91,6 +98,11 @@ if (fs.existsSync(customConfigPath)) {
...customConfig.module.loaders || [],
],
},
resolve: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now we allow to configure the resolve API directly via custom webpack API.

In this case, we simply need to document this.
What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not realized this although there is ...customConfig in the final configuration :)

The only thing is that layout needs to be imported using an alias.

This makes me think that if in the codebase instead of importing modules using a relative path webpack was configured to make a namespace using an alias, it would be easy to override any file by overriding aliases. (I find this also handy to avoid relative paths hell in big projects)

import StorybookControls from 'react-storybook/ui/controls';
import ActionLogger from 'react-storybook/ui/action_logger';
import Layout from 'react-storybook/ui/layout';
import { getSyncedStore } from 'react-storybook';
import ActionLogger from 'react-storybook/action_logger';

This could solve the problem in a generic way... Thoughts ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just realized the replacement could be achieved using NormalModuleReplacementPlugin.

@arunoda
Copy link
Member

arunoda commented Apr 6, 2016

@mnmtanish is also working on a new layout change. May be we can all follow a same format for the layout.

So, it can be extendable.

@mnmtanish what do you think?

@arunoda
Copy link
Member

arunoda commented Apr 7, 2016

Great.
Change this PR to add some documentation to here: https://github.com/kadirahq/react-storybook/blob/master/docs/api.md

You may need to create new section under webpack config.
Also, we want to add a link to the original Layout so the user know how to update.

@arunoda arunoda mentioned this pull request Apr 7, 2016
@thani-sh
Copy link
Contributor

thani-sh commented Apr 7, 2016

@arunoda @jide I think it's an awesome idea 👍
If we use webpack aliases maybe organise package modules properly, it'll be easy to extend storybook. And we can add features like viewport resizing, story search and anything else as storybook plugins.

@jide jide closed this Apr 7, 2016
@jide
Copy link
Contributor Author

jide commented Apr 7, 2016

Closed in favor of #69

ndelangen pushed a commit that referenced this pull request Apr 5, 2017
Added support for require.context similar to storyshots 2.x versions.
@shilman shilman added the misc label May 27, 2017
ndelangen pushed a commit that referenced this pull request Feb 23, 2024
Copy link

nx-cloud bot commented Mar 12, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit b368973. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

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

Successfully merging this pull request may close these issues.

4 participants