A Milkee plugin for working with Prettier for CoffeeScript without version conflicts.
npm install milkee-plugin-prettier
A Milkee plugin for working with Prettier for CoffeeScript without version conflicts.
> [!TIP]
> Uses Optimized-Prettier (by helixbass) and prettier-plugin-coffeescript (by helixbass) to format CoffeeScript files.
- Recursively finds .coffee files in the build entry directory and formats them with Prettier.
- Supports a prettierrc (object or a path to a config file) and .prettierignore to exclude files.
- Automatically resolves config via prettier.resolveConfig() or package.json#prettier when prettierrc is not provided.
``js
const prettierPlugin = require('milkee-plugin-prettier');
module.exports = {
entry: 'src',
output: 'dist',
milkee: {
plugins: [
// Pass options (optional)
prettierPlugin({
prettierrc: { tabWidth: 2 }, // or a path to a config file
prettierignore: '.prettierignore' // optional, resolved from cwd
})
]
}
};
`
You can also use this package as a standalone CLI tool to format CoffeeScript files:
`bashFormat files in the current directory
npx cprettier
The CLI will:
- Recursively find all
.coffee files in the target directory
- Respect .prettierignore and prettier config files (.prettierrc, prettier.config.js, or package.json#prettier)
- Format files in place$3
-
.prettierignore is resolved relative to process.cwd() by default. You can pass an absolute or relative path via the prettierignore option.
- When config.options.join is used and a single entry file is emitted, the plugin will use the directory of the entry file as the search root for .coffee` files.