├── .clintonrc.json ├── .editorconfig ├── .github ├── contributing.md ├── funding.yml └── workflows │ └── nodejs.yml ├── .gitignore ├── .huskyrc ├── .npmignore ├── .nycrc ├── ava.config.js ├── changelog.md ├── lib └── index.js ├── license ├── package-lock.json ├── package.json ├── readme.md ├── test ├── fixtures │ ├── basic.expected.html │ └── basic.html └── test-core.js └── xo.config.js /.clintonrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "ignores": [], 3 | "rules": { 4 | "ava": "off", 5 | "xo": "off", 6 | "use-travis": "off" 7 | } 8 | } -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 4 6 | end_of_line = lf 7 | charset = utf-8 8 | quote_type = single 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [{package.json,*.yml,*.jade,*.pss,*.css,*.js,*.md,.*,*.ts}] 13 | indent_size = 2 14 | 15 | [{changelog.md,.*}] 16 | insert_final_newline = false 17 | 18 | [*.md] 19 | trim_trailing_whitespace = false -------------------------------------------------------------------------------- /.github/contributing.md: -------------------------------------------------------------------------------- 1 | You want to help? You rock! Now, take a moment to be sure your contributions make sense to everyone else. 2 | 3 | ## Reporting Issues 4 | 5 | Found a problem? Want a new feature? 6 | 7 | - See if your issue or idea has [already been reported]. 8 | - Provide a [reduced test case] or a [live example]. 9 | 10 | Remember, a bug is a _demonstrable problem_ caused by _our_ code. 11 | 12 | ## Submitting Pull Requests 13 | 14 | Pull requests are the greatest contributions, so be sure they are focused in scope, and do avoid unrelated commits. 15 | 16 | 1. To begin, [fork this project], clone your fork, and add our upstream. 17 | ```bash 18 | # Clone your fork of the repo into the current directory 19 | git clone https://github.com//PLUGIN_NAME 20 | # Navigate to the newly cloned directory 21 | cd PLUGIN_NAME 22 | # Assign the original repo to a remote called "upstream" 23 | git remote add upstream https://github.com/GITHUB_NAME/PLUGIN_NAME 24 | # Install the tools necessary for development 25 | npm install 26 | ``` 27 | 28 | 2. Create a branch for your feature or fix: 29 | ```bash 30 | # Move into a new branch for a feature 31 | git checkout -b feature/thing 32 | ``` 33 | ```bash 34 | # Move into a new branch for a fix 35 | git checkout -b fix/something 36 | ``` 37 | 38 | 3. Be sure your code follows our practices. 39 | ```bash 40 | # Test current code 41 | npm run test 42 | ``` 43 | 44 | 4. Push your branch up to your fork: 45 | ```bash 46 | # Push a feature branch 47 | git push origin feature/thing 48 | ``` 49 | ```bash 50 | # Push a fix branch 51 | git push origin fix/something 52 | ``` 53 | 54 | 5. Now [open a pull request] with a clear title and description. 55 | 56 | [already been reported]: issues 57 | [fork this project]: fork 58 | [live example]: http://codepen.io/pen 59 | [open a pull request]: https://help.github.com/articles/using-pull-requests/ 60 | [reduced test case]: https://css-tricks.com/reduced-test-cases/ 61 | -------------------------------------------------------------------------------- /.github/funding.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: posthtml 5 | open_collective: posthtml 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /.github/workflows/nodejs.yml: -------------------------------------------------------------------------------- 1 | name: Actions Status 2 | on: 3 | pull_request: 4 | types: [opened, synchronize] 5 | branches: 6 | - master 7 | env: 8 | CI: true 9 | 10 | jobs: 11 | run: 12 | name: Node ${{ matrix.node }} on ${{ matrix.os }} 13 | runs-on: ${{ matrix.os }} 14 | 15 | strategy: 16 | fail-fast: false 17 | matrix: 18 | node: [10, 12, 14] 19 | os: [ubuntu-latest] 20 | 21 | steps: 22 | - name: Clone repository 23 | uses: actions/checkout@v2 24 | 25 | - name: Set Node.js version 26 | uses: actions/setup-node@v1 27 | with: 28 | node-version: ${{ matrix.node }} 29 | 30 | - name: Install npm dependencies 31 | run: npm ci 32 | 33 | - name: Run tests 34 | run: npm run test 35 | 36 | - name: Run Coveralls 37 | uses: coverallsapp/github-action@master 38 | with: 39 | github-token: "${{ secrets.GITHUB_TOKEN }}" 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | coverage 3 | .nyc_output 4 | npm-debug.log -------------------------------------------------------------------------------- /.huskyrc: -------------------------------------------------------------------------------- 1 | { 2 | "hooks": { 3 | "pre-push": "npm t", 4 | "commit-msg": "commitlint --extends=@commitlint/config-angular -e" 5 | } 6 | } -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .gitignore 3 | .travis.yml 4 | coverage 5 | .nyc_output -------------------------------------------------------------------------------- /.nycrc: -------------------------------------------------------------------------------- 1 | { 2 | "reporter": ["lcov", "text"], 3 | "extension": [".js"] 4 | } -------------------------------------------------------------------------------- /ava.config.js: -------------------------------------------------------------------------------- 1 | const config = { 2 | verbose: true 3 | }; 4 | 5 | export default config; 6 | -------------------------------------------------------------------------------- /changelog.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/posthtml/posthtml-plugin-boilerplate/2449e2ba212fceb5d71508237b50b44349f6ffdb/changelog.md -------------------------------------------------------------------------------- /lib/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function () { 4 | function PLUGIN_NAME_CAMEL(tree) { 5 | // Your plugin 6 | return tree; 7 | } 8 | 9 | return PLUGIN_NAME_CAMEL; 10 | }; 11 | -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | MIT License (MIT) 2 | 3 | Copyright (c) 2016 PostHTML 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "plugin_name", 3 | "version": "0.0.0", 4 | "description": "PostHTML plugin description", 5 | "license": "MIT", 6 | "repository": "USER_NAME/PLUGIN_NAME", 7 | "author": "USER_NAME", 8 | "main": "lib", 9 | "engines": { 10 | "node": ">=10" 11 | }, 12 | "scripts": { 13 | "version": "conventional-changelog -i changelog.md -s -r 0 && git add changelog.md", 14 | "test": "xo && nyc ava", 15 | "pretest": "clinton" 16 | }, 17 | "keywords": [ 18 | "html", 19 | "posthtml", 20 | "posthtml-plugin" 21 | ], 22 | "dependencies": {}, 23 | "devDependencies": { 24 | "@commitlint/cli": "^11.0.0", 25 | "@commitlint/config-angular": "^11.0.0", 26 | "ava": "^3.13.0", 27 | "clinton": "^0.14.0", 28 | "conventional-changelog-cli": "^2.0.31", 29 | "husky": "^4.3.0", 30 | "nyc": "^15.1.0", 31 | "posthtml": "^0.13.3", 32 | "xo": "^0.33.1" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # PLUGIN_NAME 2 | 3 | [![Actions Status][action]][action-url] 4 | [![NPM][npm]][npm-url] 5 | [![Coverage][cover]][cover-badge] 6 | [![XO code style][style]][style-url] 7 | 8 | Clone this repo and explain what your plugin do and why thousands of people need it ;) 9 | 10 | Before: 11 | ``` html 12 | 13 | 14 |

OMG

15 | 16 | 17 | ``` 18 | 19 | After: 20 | ``` html 21 | 22 | 23 | OMG 24 | 25 | 26 | ``` 27 | 28 | ## Install 29 | 30 | Describe how big guys can install your plugin. 31 | 32 | ```bash 33 | npm i PLUGIN_NAME 34 | ``` 35 | 36 | ## Usage 37 | 38 | Describe how people can use this plugin. Include info about build systems if it's 39 | necessary. 40 | 41 | ``` js 42 | const fs = require('fs'); 43 | const posthtml = require('posthtml'); 44 | const PLUGIN_NAME_CAMEL = require('PLUGIN_NAME'); 45 | 46 | posthtml() 47 | .use(PLUGIN_NAME_CAMEL({ /* options */ })) 48 | .process(html/*, options */) 49 | .then(result => fs.writeFileSync('./after.html', result.html)); 50 | ``` 51 | 52 | ## Options 53 | 54 | Describe all features of your plugin with examples of usage. 55 | 56 | ### Feature 57 | 58 | Before: 59 | ``` html 60 | 61 | 62 |

OMG

63 | 64 | 65 | ``` 66 | 67 | Add option: 68 | ``` js 69 | const fs = require('fs'); 70 | const posthtml = require('posthtml'); 71 | const PLUGIN_NAME_CAMEL = require('PLUGIN_NAME'); 72 | 73 | posthtml() 74 | .use(PLUGIN_NAME_CAMEL({ feature: 'wow' })) 75 | .process(html/*, options */) 76 | .then(result => fs.writeFileSync('./after.html', result.html)); 77 | ``` 78 | 79 | After: 80 | ``` html 81 | 82 | 83 |

OMG

84 | 85 | 86 | ``` 87 | 88 | ### Contributing 89 | 90 | See [PostHTML Guidelines](https://github.com/posthtml/posthtml/tree/master/docs) and [contribution guide](CONTRIBUTING.md). 91 | 92 | [action]: https://github.com/USER_NAME/PLUGIN_NAME/workflows/Actions%20Status/badge.svg 93 | [action-url]: https://github.com/USER_NAME/PLUGIN_NAME/actions?query=workflow%3A%22CI+tests%22 94 | 95 | [npm]: https://img.shields.io/npm/v/PLUGIN_NAME.svg 96 | [npm-url]: https://npmjs.com/package/PLUGIN_NAME 97 | 98 | [style]: https://img.shields.io/badge/code_style-XO-5ed9c7.svg 99 | [style-url]: https://github.com/xojs/xo 100 | 101 | [cover]: https://coveralls.io/repos/USER_NAME/PLUGIN_NAME/badge.svg?branch=master 102 | [cover-badge]: https://coveralls.io/r/USER_NAME/PLUGIN_NAME?branch=master 103 | -------------------------------------------------------------------------------- /test/fixtures/basic.expected.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/fixtures/basic.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /test/test-core.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const test = require('ava'); 4 | const plugin = require('../lib'); 5 | const {readFileSync} = require('fs'); 6 | const path = require('path'); 7 | const posthtml = require('posthtml'); 8 | const fixtures = path.join(__dirname, 'fixtures'); 9 | 10 | test('basic', t => { 11 | return compare(t, 'basic'); 12 | }); 13 | 14 | async function compare(t, name) { 15 | const source = readFileSync(path.join(fixtures, `${name}.html`), 'utf8'); 16 | const expected = readFileSync(path.join(fixtures, `${name}.expected.html`), 'utf8'); 17 | const {html} = await posthtml([plugin()]).process(source); 18 | 19 | t.deepEqual(html, expected); 20 | } 21 | -------------------------------------------------------------------------------- /xo.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | space: true, 3 | rules: { 4 | } 5 | }; 6 | --------------------------------------------------------------------------------