-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new(gatsby-plugin-vanilla-extract): add to repo (#148)
* add new package * Update packages/gatsby-plugin-vanilla-extract/README.md Co-authored-by: Lennart <lekoarts@gmail.com> * Update packages/gatsby-plugin-vanilla-extract/README.md Co-authored-by: Lennart <lekoarts@gmail.com> * Update packages/gatsby-plugin-vanilla-extract/README.md Co-authored-by: Lennart <lekoarts@gmail.com> * Update packages/gatsby-plugin-vanilla-extract/README.md Co-authored-by: Lennart <lekoarts@gmail.com> * Update packages/gatsby-plugin-vanilla-extract/README.md Co-authored-by: Lennart <lekoarts@gmail.com> * update package.json * remove renovate.json file * Update packages/gatsby-plugin-vanilla-extract/README.md Co-authored-by: Lennart <lekoarts@gmail.com> * update lock file * use old version number * add changeset * remove useless files * format code * docs: add @KyleAMathews as a contributor * docs: add @marvinjude as a contributor * Update packages/gatsby-plugin-vanilla-extract/package.json Co-authored-by: Lennart <lekoarts@gmail.com> * fix: remove bad tets * Update .changeset/big-coins-smoke.md Co-authored-by: Lennart <lekoarts@gmail.com> Co-authored-by: Lennart <lekoarts@gmail.com> Co-authored-by: Alex Moon <alex.jared.moon@gmail.com>
- Loading branch information
1 parent
a654620
commit 732226d
Showing
9 changed files
with
145 additions
and
2 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
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,13 @@ | ||
--- | ||
"gatsby-plugin-vanilla-extract": major | ||
--- | ||
|
||
This moves the repository from [KyleAMathews/gatsby-plugin-vanilla-extract](https://github.com/KyleAMathews/gatsby-plugin-vanilla-extract) to [gatsby-uc/plugins](https://github.com/gatsby-uc/plugins) to help with better maintenance on the plugin itself. | ||
|
||
There was also a breaking change made to the plugin: The `vanilla-extract` dependencies are now marked as `peerDependencies` and not bundled with the plugin anymore. | ||
|
||
In order to migrate, run the following in your terminal: | ||
|
||
```shell | ||
npm install gatsby-plugin-vanilla-extract@latest @vanilla-extract/babel-plugin @vanilla-extract/css @vanilla-extract/webpack-plugin | ||
``` |
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,66 @@ | ||
# gatsby-plugin-vanilla-extract | ||
|
||
Gatsby plugin which wraps the [vanilla-extract](https://vanilla-extract.style/) project for easy use in Gatsby. | ||
|
||
## Setup | ||
|
||
```shell | ||
npm install gatsby-plugin-vanilla-extract @vanilla-extract/babel-plugin @vanilla-extract/css @vanilla-extract/webpack-plugin | ||
``` | ||
|
||
Add to your site's `gatsby-config.js`. | ||
|
||
```js | ||
module.exports = { | ||
plugins: [`gatsby-plugin-vanilla-extract`], | ||
}; | ||
``` | ||
|
||
You can also pass any [vanilla-extract configuration object](https://vanilla-extract.style/documentation/setup/#configuration) to the plugin. | ||
|
||
```js | ||
module.exports = { | ||
plugins: [ | ||
{ | ||
resolve: `gatsby-plugin-vanilla-extract`, | ||
options: { | ||
identifiers: `short`, | ||
}, | ||
}, | ||
], | ||
}; | ||
``` | ||
|
||
## How to use | ||
|
||
See the [vanilla-extract website](https://vanilla-extract.style/) for full documentation. | ||
|
||
`src/pages/index.tsx`: | ||
|
||
```tsx | ||
import * as React from "react"; | ||
|
||
import { className } from "../styles/index.css.ts"; | ||
|
||
export default function Index() { | ||
return <div className={className}>Pizza</div>; | ||
} | ||
``` | ||
|
||
`src/styles/index.css.ts`: | ||
|
||
```ts | ||
import { style } from "@vanilla-extract/css"; | ||
|
||
export const className = style({ | ||
background: "red", | ||
}); | ||
``` | ||
|
||
### Example Project | ||
|
||
Kick off your project using Gatsby's [example project](TODO) | ||
|
||
## Useful Links | ||
|
||
- [TypeScript & Gatsby](https://www.gatsbyjs.com/docs/how-to/custom-configuration/typescript/) |
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,13 @@ | ||
const { VanillaExtractPlugin } = require("@vanilla-extract/webpack-plugin"); | ||
|
||
exports.onCreateBabelConfig = ({ actions }, pluginOptions) => { | ||
actions.setBabelPlugin({ | ||
name: require.resolve(`@vanilla-extract/babel-plugin`), | ||
}); | ||
}; | ||
|
||
exports.onCreateWebpackConfig = ({ actions }, pluginOptions) => { | ||
actions.setWebpackConfig({ | ||
plugins: [new VanillaExtractPlugin(pluginOptions)], | ||
}); | ||
}; |
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,27 @@ | ||
{ | ||
"name": "gatsby-plugin-vanilla-extract", | ||
"version": "1.0.6", | ||
"description": "Gatsby plugin which wraps the vanilla-extract package for easy use", | ||
"main": "index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/gatsby-uc/plugins.git", | ||
"directory": "packages/gatsby-plugin-vanilla-extract" | ||
}, | ||
"keywords": [ | ||
"gatsby", | ||
"gatsby-plugin" | ||
], | ||
"author": "Kyle Mathews <mathews.kyle@gmail.com>", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/gatsby-uc/plugins/issues" | ||
}, | ||
"homepage": "https://github.com/gatsby-uc/plugins/tree/main/packages/gatsby-plugin-vanilla-extract#readme", | ||
"peerDependencies": { | ||
"@vanilla-extract/babel-plugin": "^1.0.0", | ||
"@vanilla-extract/css": "^1.0.0", | ||
"@vanilla-extract/webpack-plugin": "^2.0.0", | ||
"gatsby": "^3.0.0 || ^4.0.0" | ||
} | ||
} |
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