React-styleguidist: Simpler way of replacing Styleguidist components

Created on 9 Jun 2017  路  5Comments  路  Source: styleguidist/react-styleguidist

Right now to use Redux providers, React Intl, Relay etc. you need to use webpack aliases like this:

// styleguide.config.js
const path = require('path');
module.exports = {
  webpackConfig: {
    resolve: {
      alias: {
        'rsg-components/Wrapper': path.join(__dirname, 'lib/styleguide/Wrapper')
      }
    }
  }
};

I think we have enough use cases to add a special config option for that. It could look like this:

// styleguide.config.js
const path = require('path');
module.exports = {
  styleguideComponents: {
    Wrapper: path.join(__dirname, 'lib/styleguide/Wrapper')
  }
};
  • [x] Add a new config option to the schema (scripts/schemas/config.js)
  • [x] Generate webpack aliases based on the new option (scripts/make-webpack-config.js)
  • [x] Add docs for the config option (docs/Configuration.md)
  • [x] Update examples in the docs to use the new option instead of webpack aliases (mostly the cookbook, but better to check other files)
good first issue help wanted

All 5 comments

I think ,we don't need config option for that.
Webpack aliases is simple to understand.
And i think that aliases like this (with full path)

 alias: {
       './node_module/react-styleguidist/rsg-components/Wrapper': pathToYourComponent
 }

is more simple to understand and more simple for override.
when i see 'rsg-components/Wrapper' i can't understand what is rsg-components wrapper.
It looks like another package

That鈥檚 a good reason to have a simple to understand option ;-)

:D

There鈥檚 a PR: https://github.com/styleguidist/react-styleguidist/issues/504 ;-)

Released in 5.5.0.

Was this page helpful?
0 / 5 - 0 ratings