Skip to content

Commit

Permalink
Include Gatsby webpack incantation (dfee#75)
Browse files Browse the repository at this point in the history
Based on issue dfee#74, I've adjusted the Readme to include:

* Additional info on the Gatsby setup
* Making it clearer you may need to make a `_variables.sass` file even if you don't want to override styles
* Made it clearer that the path needs to end in _variables.sass - that was ambiguous when I was trying to use this
  • Loading branch information
stefl authored and couds committed Sep 2, 2018
1 parent 4354d40 commit c43e4cf
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ You can find the Storybook stories of all components [here](https://couds.github

### To Use

Follow the instructions for creating a `_variables.sass` for your project, then:

```javascript
import React from 'react';
// You can import from the global component (you will need to include the css file dist/react-bulma-components.min.css)
Expand Down Expand Up @@ -108,19 +110,36 @@ $primary: #f4f4f4
@import '~bulma/sass/utilities/_all.sass'
```

It may be necessary, depending on your project setup, to create this file, even if you do not intend on overriding default styles.

After that you will need to add an alias pointing to the file to your webpack configuration

```
resolve {
// Other resolve props
alias: {
// Other aliases
'_variables.sass': path.resolve(__dirname, 'relative/path/to/your/file/from/webpack/config/file'),
'_variables.sass': path.resolve(__dirname, 'relative/path/from/webpack/config/to/your/_variables.sass'),
},
}
```

For Gatsby.js you can add a `modifyWebpackConfig` export to your `gatsby-node.js` file:

```
exports.modifyWebpackConfig = ({config, env}) => {
config.merge({
resolve: {
alias: {
'_variables.sass': path.resolve(__dirname, 'relative/path/from/webpack/config/to/your/_variables.sass')
}
}
})
return config
}
```

### Override Bulma variables in CRA _without_ eject

Sometimes, you don't want to eject your CRA (Create React App) application. But how to make custom style variables for Bulma? There is a simple and right way to solve it!
Expand Down

0 comments on commit c43e4cf

Please sign in to comment.