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

Loading styles with browserify #129

Closed
ghosh opened this issue Apr 20, 2016 · 2 comments
Closed

Loading styles with browserify #129

ghosh opened this issue Apr 20, 2016 · 2 comments

Comments

@ghosh
Copy link

ghosh commented Apr 20, 2016

Is there any way of loading styles with browserify? Similar to like that of webpack?

@ghosh ghosh closed this as completed Apr 20, 2016
@billgloff
Copy link

@ghosh Did you find a way to load styles via Browserify? I'm having the same issue and can't get any styling loaded. Thanks in advance!

@ghosh
Copy link
Author

ghosh commented May 3, 2016

@billgloff I realized that you don't really need to lead styles via browserify. A webpack conf already comes bundled with react-storybook. Therefore you can use browserify for your app, while storybook uses webpack.

All you need to do is install the loaders locally, npm install --save-dev style-loader raw-loader , and point the compiled css file in .storybook/config.js.

This helped me - https://github.com/kadirahq/react-storybook/blob/master/docs/setting_up_for_css.md

This is what my .storybook/webpack.config.js looks like

const path = require('path');

module.exports = {
  module: {
    loaders: [
      {
        test: /\.css?$/,
        loaders: [ 'style', 'raw' ],
        include: path.resolve(__dirname, '../')
      }
    ]
  }
}

And then you can just require your main compiled css file into the .storybook/config.js. Here is mine:-

import { configure } from '@kadira/storybook';
require('../public/css/app.css');

function loadStories() {
  // require as many stories as you need.
}

configure(loadStories, module);

Hope this helps.

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

No branches or pull requests

2 participants