Skip to content

Commit

Permalink
Merge pull request #2826 from Quramy/angular-remove-css-workaround-guide
Browse files Browse the repository at this point in the history
extending webpack section is no longer needed for the common usage
  • Loading branch information
igor-dv authored Jan 24, 2018
2 parents da35aa9 + cd1d3d0 commit 1db26ce
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions docs/src/pages/basics/guide-angular/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,33 +113,3 @@ npm run storybook

Now you can change components and write stories whenever you need to.
You'll get those changes into Storybook in a snap with the help of webpack's HMR API.

## Tips

### Configure style rules

If you use `templateUrl` in your components, you need to configure webpack rules for .css/.scss files. Create a file named `webpack.config.js` under the config directory(by default `.storybook`):

```js
const genDefaultConfig = require('@storybook/angular/dist/server/config/defaults/webpack.config.js');

module.exports = (baseConfig, env) => {
const config = genDefaultConfig(baseConfig, env);

// Overwrite .css rule
const cssRule = config.module.rules.find(rule => rule.test && rule.test.toString() === '/\\.css$/');
if (cssRule) {
cssRule.exclude = /\.component\.css$/;
}

// Add .scss rule
config.module.rules.unshift({
test: /\.scss$/,
loaders: ['raw-loader', 'sass-loader'],
});

return config;
};
```

If you want more details, see [customize the webpack config](/configurations/custom-webpack-config/).

0 comments on commit 1db26ce

Please sign in to comment.