forked from gatsbyjs/gatsby
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new Gatsby plugin for Lodash which adds their webpack & babel plu…
…gins to builds. (gatsbyjs#2162) * Add gatsby-plugin-lodash * Make new packages default to 1.0.0 * Publish - [email protected]
- Loading branch information
1 parent
ed945ae
commit ce58928
Showing
10 changed files
with
103 additions
and
1 deletion.
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,3 @@ | ||
/*.js | ||
!index.js | ||
yarn.lock |
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,34 @@ | ||
# Logs | ||
logs | ||
*.log | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directory | ||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git | ||
node_modules | ||
*.un~ | ||
yarn.lock | ||
src | ||
flow-typed | ||
coverage | ||
decls | ||
examples |
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,18 @@ | ||
# gatsby-plugin-lodash | ||
|
||
Adds the Lodash webpack & Babel plugins for easy modular, small Lodash builds. | ||
|
||
## Install | ||
|
||
`npm install --save gatsby-plugin-lodash` | ||
|
||
## How to use | ||
|
||
Simply add the plugin to your `gatsby-config.js`. | ||
|
||
```javascript | ||
plugins: [ | ||
`gatsby-plugin-lodash`, | ||
] | ||
``` | ||
|
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 @@ | ||
// noop |
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,26 @@ | ||
{ | ||
"name": "gatsby-plugin-lodash", | ||
"version": "1.0.1", | ||
"description": "Easy modular Lodash builds. Adds the Lodash webpack & Babel plugins to your Gatsby build", | ||
"main": "index.js", | ||
"scripts": { | ||
"build": "babel src --out-dir . --ignore __tests__", | ||
"watch": "babel -w src --out-dir . --ignore __tests__", | ||
"prepublish": "cross-env NODE_ENV=production npm run build" | ||
}, | ||
"keywords": [ | ||
"gatsby" | ||
], | ||
"author": "Kyle Mathews <[email protected]>", | ||
"license": "MIT", | ||
"dependencies": { | ||
"babel-plugin-lodash": "^3.2.11", | ||
"babel-runtime": "^6.26.0", | ||
"lodash": "^4.17.4", | ||
"lodash-webpack-plugin": "^0.11.4" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.26.0", | ||
"cross-env": "^5.0.5" | ||
} | ||
} |
Empty file.
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,18 @@ | ||
const webpackLodashPlugin = require(`lodash-webpack-plugin`) | ||
|
||
// Add Lodash webpack plugin | ||
exports.modifyWebpackConfig = ({ config, stage }) => { | ||
if (stage === `build-javascript`) { | ||
config.plugin(`Lodash`, webpackLodashPlugin, null) | ||
} | ||
|
||
return | ||
} | ||
|
||
// Add Lodash Babel plugin | ||
exports.modifyBabelrc = ({ babelrc }) => { | ||
return { | ||
...babelrc, | ||
plugins: babelrc.plugins.concat([`lodash`]), | ||
} | ||
} |
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