https://github.com/alsiola/plop-prettier
Use prettier to format plop templates
https://github.com/alsiola/plop-prettier
plop prettier
Last synced: 11 months ago
JSON representation
Use prettier to format plop templates
- Host: GitHub
- URL: https://github.com/alsiola/plop-prettier
- Owner: alsiola
- License: mit
- Created: 2017-09-07T17:10:09.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-10-14T19:08:10.000Z (over 6 years ago)
- Last Synced: 2025-04-30T08:51:52.899Z (about 1 year ago)
- Topics: plop, prettier
- Language: TypeScript
- Size: 13.7 KB
- Stars: 12
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# plop-prettier
Use prettier to format plop templates with a custom plop action type.
## Installation
````
npm i --save plop-prettier
````
## Usage
In your base plopfile, use `plop.load` to add the "pretty-add" action::
````
const aGenerator = require("./path/to/a/generator");
module.exports = function(plop) {
plop.load("plop-prettier");
plop.setGenerator("Generator Name", aGenerator);
};
````
You can now use the "pretty-add" action type within your generators:
````
const anAction = {
type: "pretty-add",
path: "path/to/generated/file",
template: "path/to/template"
};
````
## Options
Prettier options can be provided - for information on available prettier options see the [prettier docs](https://github.com/prettier/prettier#options).
````
const aGenerator = require("./path/to/a/generator");
module.exports = function(plop) {
plop.load("plop-prettier", {
tabWidth: 4
});
plop.setGenerator("Generator Name", aGenerator);
};
````