Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jsonkao/snowpack-plugin-posthtml
This plugin adds PostHTML support to any Snowpack project.
https://github.com/jsonkao/snowpack-plugin-posthtml
posthtml snowpack snowpack-plugin
Last synced: 29 days ago
JSON representation
This plugin adds PostHTML support to any Snowpack project.
- Host: GitHub
- URL: https://github.com/jsonkao/snowpack-plugin-posthtml
- Owner: jsonkao
- Created: 2021-03-29T12:32:44.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-03-29T14:50:37.000Z (almost 4 years ago)
- Last Synced: 2024-12-02T09:57:36.682Z (about 1 month ago)
- Topics: posthtml, snowpack, snowpack-plugin
- Language: JavaScript
- Homepage:
- Size: 25.4 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @jsonkao/snowpack-plugin-posthtml
This plugin adds [PostHTML](https://github.com/posthtml/posthtml) support to any Snowpack project. The plugin loads your PostHTML configuration and reloads dependent HTML files when the configuration changes.
## Usage
```sh
npm i -D @jsonkao/snowpack-plugin-posthtml
```Then add the plugin to your Snowpack config:
```js
// snowpack.config.jsmodule.exports = {
plugins: [
[
'@jsonkao/snowpack-plugin-posthtml',
{
/* see options below */
},
],
],
};
```## Plugin Options
PostHTML configuration works out of the box. The following plugin options help when you want the changing of that configuration to reload your HTML and refresh the dev page.
| Name | Type | Description |
| :----- | :----------------------------: | :------------------------------------------------------------ |
| `root` | `string, string[]` | Specify the local directories in which the HTML should be reloaded on configuration change |
| `configOptions.*` | `object` | Pass [`posthtml-load-config` options](https://github.com/posthtml/posthtml-load-config/blob/master/index.js#L14) directly to the loader (see `configOptions`).## `configOptions`
These options are passed directtly into the main [`posthtml-load-config` function](https://github.com/posthtml/posthtml-load-config/blob/master/index.js#L14). They may be helpful, for instance, if your PostHTML configuration is not in your application's root directory.
| Name | Type | Description |
| :----- | :----------------------------: | :------------------------------------------------------------ |
| `ctx` | `object` | The context [evaluated while](https://github.com/posthtml/posthtml-load-config#context) loading your config |
| `path` | `string` | Path in which I should look for your config |
| `options` | `object` | Options passed directly to [`cosmiconfig`](https://github.com/davidtheclark/cosmiconfig#cosmiconfigoptions) |