-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from enduire/add-plugins
V2
- Loading branch information
Showing
14 changed files
with
733 additions
and
287 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Contributing guide | ||
|
||
## Testing | ||
|
||
We use Jest as our test runner. Invoke `yarn test` to run all tests. | ||
|
||
## Writing a plugin | ||
|
||
A Happo plugin is basically an object with a few methods/properties defined, | ||
along with an optional set of files. | ||
|
||
### `customizeWebpackConfig` | ||
Similar to the `customizeWebpackConfig` configuration option, this is a method | ||
that allows you to extend/customize the default webpack configuration used by | ||
Happo. | ||
|
||
```js | ||
module.exports = { | ||
customizeWebpackConfig: config => { | ||
config.plugins.push(new MyOwnWebpackPlugin()), | ||
}, | ||
} | ||
``` | ||
|
||
### `pathToExamplesFile` | ||
Specify a path to a file that gets added to the list of happo example files | ||
being parsed. The most common usecase here would be to auto-generate Happo | ||
examples from a different source. | ||
|
||
```js | ||
const path = require('path'); | ||
|
||
module.exports = { | ||
pathToExamplesFile: path.resolve(__dirname, 'myHappoExamples.js'), | ||
} | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import React from 'react'; | ||
|
||
// This is a funky file testing the customizeWebpackFunction for plugins | ||
export default () => <button>Click me</button>; |
Oops, something went wrong.