prettify gatsby build output
npm install --save gatsby-plugin-prettier-build
# or
yarn add gatsby-plugin-prettier-build
In gatsby-config.js
plugins array:
To stick to default options (see defaults below) add:
`gatsby-plugin-prettier-build`
Or to provide custom options:
{
resolve: `gatsby-plugin-prettier-build`,
options: {
// default values
types: ['html'],
concurrency: 20,
verbose: true
}
}
default:
['html']
Array of filetypes to be prettified after build. Currently supports:
js
html
css
For example, to prettify all supported types: ['html', 'js', 'css']
default:
true
Whether or not to log progress to the console
default:
20
How many files to prettify at once
You can remove the concurrency limit with concurrency: Infinity
although this isn't recommended
- Stop plugin from breaking on prettier failure
- Add
gatsby-plugin
to package keywords #2 (thanks @KyleAMathews) - Minor docs fix
- Fix bug where undefined
types
option throws error ononPreInit
options validation
- Docs fix
- Limit prettify concurrency with new
concurrency
option (defaults to20
) - Fix issue with counting number of prettified files
- Prettify files asynchronously with
Promise.all
- Replace
glob
withtiny-glob
(smaller and faster) - Validate options on
onPreInit
to avoid hitting config problems post-build (saves time if there's a predictable problem) fs.stat
filepaths to make sure they're files - avoids trying to read directories (page-data
etc.) as files
Initial version