Skip to content
This repository was archived by the owner on Jan 17, 2024. It is now read-only.

Commit 966f92e

Browse files
committed
Add package contents
1 parent f69a2a3 commit 966f92e

File tree

5 files changed

+76
-1
lines changed

5 files changed

+76
-1
lines changed

.prettierrc.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
printWidth: 100,
3+
singleQuote: true,
4+
trailingComma: 'es5',
5+
};

README.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,31 @@
11
# gatsby-plugin-mantine
2-
Setup Mantine with Gatsy.js
2+
3+
Enables server side rendering for [Mantine](https://mantine.dev/) components.
4+
5+
## Installation
6+
7+
With yarn:
8+
9+
```bash
10+
yarn add --dev gatsby-plugin-mantine
11+
```
12+
13+
With npm:
14+
15+
```bash
16+
npm install gatsby-plugin-mantine
17+
```
18+
19+
## Usage
20+
21+
Add `gatsby-plugin-mantine` to your `gatsby-config.js`:
22+
23+
```tsx
24+
module.exports = {
25+
plugins: ["gatsby-plugin-mantine" /* ...other plugins */],
26+
};
27+
```
28+
29+
## License
30+
31+
MIT

gatsby-ssr.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const React = require('react');
2+
const { renderToString } = require('react-dom/server');
3+
const { createStylesServer, ServerStyles } = require('@mantine/ssr');
4+
5+
const stylesServer = createStylesServer();
6+
7+
export const replaceRenderer = ({ bodyComponent, replaceBodyHTMLString, setHeadComponents }) => {
8+
const html = renderToString(bodyComponent);
9+
setHeadComponents([
10+
React.createElement(ServerStyles, {
11+
html: html,
12+
server: stylesServer,
13+
key: 'mantine-styles',
14+
}),
15+
]);
16+
replaceBodyHTMLString(html);
17+
};

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// noop

package.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "gatsby-plugin-mantine",
3+
"version": "4.0.0",
4+
"main": "index.js",
5+
"license": "MIT",
6+
"author": "Vitaly Rtishchev <[email protected]>",
7+
"sideEffects": false,
8+
"homepage": "https://mantine.dev",
9+
"repository": {
10+
"url": "https://github.com/mantinedev/mantine.git",
11+
"type": "git",
12+
"directory": "src/mantine-hooks"
13+
},
14+
"peerDependencies": {
15+
"gatsby": "*",
16+
"react": "*",
17+
"react-dom": "*"
18+
},
19+
"dependencies": {
20+
"@mantine/ssr": ">=3.6.14"
21+
},
22+
"devDependencies": {}
23+
}

0 commit comments

Comments
 (0)