PostHTML
Autoload Plugins forInstall
npm i -D posthtml-load-plugins
Usage
Plugins will be loaded directly from your projects package.json file or local installed plugins.
Install them as usual with npm i -S
or npm i -D
or npm i
.
After installing your plugins there a three ways to declare your plugin options.
- Set options directly as arguments.
- Set options in your package.json.
- Create a separated [name].[ext] file, where [name] is any name you like and [ext] should be either
.js
or.json
. For an example of well formed options file see below. - For plugins not having rules installed locally will be used default settings.
- Pretty reporting about not installed plugins.
Options
package.json
[name].[ext]
JS
```js
module.exports = {
bem: {
elemPrefix: '__',
modPrefix: '-',
modDlmtr: '--'
},
include: {
root: './',
encoding: 'utf-8'
},
styleToFile: {
path: './dist/style.css'
}
}
or
moduleexports = bem: elemPrefix: '__' modPrefix: '-' modDlmtr: '--' include: root: './' encoding: 'utf-8' styleToFile: path: './dist/style.css'
JSON
Usage
For general usage and build process integration see PostHTML Docs
Examples using Node API
Default
const fs = ; const posthtml = ;const plugins = ; let html = fs; ;
Options file (e.g posthtml.json)
const fs = ; const posthtml = ;const plugins = 'posthtml.(js|json)'; let html = fs; ;
Extends options
const fs = ; const posthtml = ;const plugins = 'posthtml.(js|json)' "posthtml-bem": elemPrefix: '__'; let html = fs; ;
posthtml-standard-config
Use withconst fs = ; const posthtml = ;const standardConfig = ;const plugins = standardConfig; let html = fs; ;
Contributors
Ivan Demidov |
License
MIT