This plugin adds PostHTML support to any Snowpack project. The plugin loads your PostHTML configuration and reloads dependent HTML files when the configuration changes.
npm i -D @jsonkao/snowpack-plugin-posthtml
Then add the plugin to your Snowpack config:
// snowpack.config.js
module.exports = {
plugins: [
[
'@jsonkao/snowpack-plugin-posthtml',
{
/* see options below */
},
],
],
};
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 directly to the loader (see configOptions ). |
These options are passed directtly into the main posthtml-load-config
function. 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 loading your config |
path |
string |
Path in which I should look for your config |
options |
object |
Options passed directly to cosmiconfig |