Skip to content

Commit

Permalink
update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Freezystem committed Dec 3, 2023
1 parent 65fb9b1 commit 6efbe62
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 31 deletions.
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,31 @@ Then add the package to your `.mjmlconfig` file:

```json
{
"packages": ["mjml-bar-chart/lib/index.js"]
"packages": ["mjml-bar-chart/build/index.js"]
}
```

Or import it and manually register the plugin.

with **ESM**:
```ecmascript 6
import { registerComponent } from "mjml-core";
import MjBarChart from "@freezystem/mjml-bar-chart";
registerComponent(MjBarChart);
```

with **CJS**:
```ecmascript 6
const { registerComponent } = require("mjml-core");
const MjBarChart = require("@freezystem/mjml-bar-chart");
registerComponent(MjBarChart);
```

You can now use the `mjml-bar-chart` component in your MJML templates:

```xml
```mjml
<mjml>
<mj-body>
<mj-section>
Expand Down
18 changes: 0 additions & 18 deletions index.mjml

This file was deleted.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
},
"version": "1.1.1",
"description": "A simple MJML component to make static bar charts",
"main": "./build/umd/index.js",
"main": "./build/index.js",
"module": "./build/esm/index.js",
"types": "./build/types/index.d.ts",
"exports": {
".": {
"types": "./build/types/index.d.ts",
"require": "./build/umd/index.js",
"require": "./build/index.js",
"import": "./build/esm/index.js",
"default": "./build/umd/index.js"
"default": "./build/index.js"
}
},
"scripts": {
"watch": "tsc --watch",
"prebuild": "rm -rf build",
"build": "tsc -b tsconfig.umd.json tsconfig.esm.json tsconfig.types.json",
"build": "tsc -b tsconfig.json tsconfig.esm.json tsconfig.types.json",
"postinstall": "npm run build",
"test": "jest",
"deps": "npm-check -u",
Expand Down
2 changes: 2 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"compilerOptions": {
"rootDir": "src",
"types": ["node", "jest", "mjml", "mjml-core", "mjml-validator"],
"outDir": "build",
"module": "commonjs",
"target": "ESNext",
"moduleResolution": "node",
"esModuleInterop": true,
Expand Down
7 changes: 0 additions & 7 deletions tsconfig.umd.json

This file was deleted.

0 comments on commit 6efbe62

Please sign in to comment.