posthtml-use
v1.0.2
Published
Use Plugin for PostHTML
Downloads
6
Readme
PostHTML Use
Install
$ npm i -D posthtml-use
Status
| Branch | Build | Coverage | |:--------------------:|:-------------------------:|:------------------------:| | Master | | | | Develop | | | | Release/v1.0.0 | | |
Usage
Add all plugins with @-rule syntax at the top of the file. Options set within the use plugin or loaded directly from package.json or any file.(js|json). Option keys named without the posthtml-prefix and hyphenated names must use quotes.
@use posthtml-bem
// add another...
<!DOCTYPE html>
Options
posthtml([ use({bem: {elemPrefix: '__', modPrefix: '--', modDlmtr: '-'}) ])
posthtml([ use('./package.json') ])
posthtml([ use('./path/to/[file].(js|json)') ])
package.json
{
"posthtml": {
"bem": {
"elemPrefix": "__",
"modPrefix": "--",
"modDlmtr": "-"
}
}
}
file.(js|json)
module.exports = {
bem: {
elemPrefix: '__',
modPrefix: '--',
modDlmtr: '-'
}
}
{
"bem": {
"elemPrefix": "__",
"modPrefix": "--",
"modDlmtr": "-"
}
}
Example
@use posthtml-bem
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>PostHTML Use</title>
</head>
<body>
<div block="use">
<section elem="bem"></section>
<section elem="bem" mod="awesome"></section>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>PostHTML Use</title>
</head>
<body>
<div class="use">
<section class="use__bem"></section>
<section class="use__bem use__bem--awesome"></section>
</div>
</body>
</html>
LICENSE
MIT License (MIT)
Copyright (c) 2016 Michael Ciniawsky
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.