All Projects → prettier → plugin-pug

prettier / plugin-pug

Licence: MIT license
Prettier Pug Plugin

Programming Languages

typescript
32286 projects
Pug
443 projects
javascript
184084 projects - #8 most used programming language
Vue
7211 projects
shell
77523 projects

Projects that are alternatives of or similar to plugin-pug

Plugin Php
Prettier PHP Plugin
Stars: ✭ 1,243 (+662.58%)
Mutual labels:  formatter, prettier
Prettier Plugin Apex
Code formatter for the Apex Programming Language
Stars: ✭ 138 (-15.34%)
Mutual labels:  formatter, prettier
Parallel Prettier
Concurrent prettier runner
Stars: ✭ 84 (-48.47%)
Mutual labels:  formatter, prettier
Prettier Eslint
Code ➡️ prettier ➡️ eslint --fix ➡️ Formatted Code ✨
Stars: ✭ 3,435 (+2007.36%)
Mutual labels:  formatter, prettier
Poetic
Automatically install and maintain ESLint, Prettier, EditorConfig and Airbnb rules for JavaScript, TypeScript and React.
Stars: ✭ 165 (+1.23%)
Mutual labels:  formatter, prettier
Prettier Eslint Cli
CLI for prettier-eslint
Stars: ✭ 451 (+176.69%)
Mutual labels:  formatter, prettier
Javascriptprettier
A Visual Studio extension
Stars: ✭ 118 (-27.61%)
Mutual labels:  formatter, prettier
pre-commit-hooks
Standardizing our code quality tooling 🛠️
Stars: ✭ 44 (-73.01%)
Mutual labels:  formatter, prettier
website-template
静的Webサイト制作を少しモダンにするためのテンプレート
Stars: ✭ 62 (-61.96%)
Mutual labels:  prettier, pug
Spotless
Keep your code spotless
Stars: ✭ 2,285 (+1301.84%)
Mutual labels:  formatter, prettier
prettier-eslint-atom
DEPRECATED IN FAVOR OF prettier-atom + ESLint integration
Stars: ✭ 64 (-60.74%)
Mutual labels:  formatter, prettier
Prettyhtml
💅 The formatter for the modern web https://prettyhtml.netlify.com/
Stars: ✭ 241 (+47.85%)
Mutual labels:  formatter, prettier
prettier-check
Check that all files match prettier code style.
Stars: ✭ 54 (-66.87%)
Mutual labels:  formatter, prettier
Prettier Atom
An atom package for the prettier formatter.
Stars: ✭ 750 (+360.12%)
Mutual labels:  formatter, prettier
csharpier
CSharpier is an opinionated code formatter for c#.
Stars: ✭ 337 (+106.75%)
Mutual labels:  formatter, prettier
Prettier
Prettier is an opinionated code formatter.
Stars: ✭ 41,411 (+25305.52%)
Mutual labels:  formatter, prettier
prettier
📦 Opinionated but Incredible Prettier plugins.
Stars: ✭ 98 (-39.88%)
Mutual labels:  prettier, prettier-plugin
Pettier
Prettier config that randomizes options and arbitrarily switches between spaces and tabs 🙄
Stars: ✭ 149 (-8.59%)
Mutual labels:  formatter, prettier
Prettier Plugin Csharp
Prettier C# Plugin
Stars: ✭ 224 (+37.42%)
Mutual labels:  formatter, prettier
Typescript Express Starter
🚀 TypeScript Express Starter
Stars: ✭ 238 (+46.01%)
Mutual labels:  formatter, prettier

     Prettier           Pug     

Prettier Pug plugin

license: MIT NPM package downloads Code Style: Prettier Build Status

Intro

Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.

This plugin adds support for the Pug language to Prettier.


Getting started

Simply install prettier and @prettier/plugin-pug as your project’s devDependencies:

npm add --save-dev prettier @prettier/plugin-pug
# or
yarn add --dev prettier @prettier/plugin-pug
# or
pnpm add --save-dev prettier @prettier/plugin-pug

Usage

npx prettier --write "**/*.pug"
# or
yarn prettier --write "**/*.pug"
# or
pnpm prettier --write "**/*.pug"

Configuration

See documentation

Workaround / Known Issue

There are some code examples that are not formatted well with this plugin and can damage your code.
But there are workarounds for it. These generate even better pug code!

Example

Issue 114

If you have tags at the top/root that are indented, they will lose indentation due to a technical limitation of pug.
Please check these before committing after running this plugin for the first time and fix them manually.

Integration with editors

If you are using a text editor that supports Prettier integration (e.g. Atom), you can have all Prettier perks for your Pug code too!

Use VSCode extension to get support for VSCode.

In order to get @prettier/plugin-pug working in projects that do not have local npm dependencies, you can install this plugin globally:

npm install --global prettier @prettier/plugin-pug

In this case, you might need to check the settings of your editor’s Prettier extension to make sure that a globally installed Prettier is used when it is not found in project dependencies (i.e. package.json).

Nevertheless, it is recommended to rely on local copies of prettier and @prettier/plugin-pug as this reduces the chance of formatting conflicts between project collaborators. This may happen if different global versions of Prettier or its Pug plugin are used.

Installing @prettier/plugin-pug either locally or globally may require you to restart the editor if formatting does not work right away.

Implementation details

This plugin is written in TypeScript and its quality is maintained using Prettier and Vitest.

Contributing

If you’re interested in contributing to the development of Prettier for Pug, you can follow the CONTRIBUTING guide from Prettier, as it all applies to this repository too.

To run @prettier/plugin-pug locally:

  • Clone this repository.
  • Execute pnpm install.
  • Execute pnpm run lint to make sure that the code passes formatting and linting.
  • Execute pnpm run test to make sure that TypeScript successfully compiles into JavaScript and all unit tests pass.

Credits

This project was inspired by https://github.com/gicentre/prettier-plugin-elm.
Many thanks also to @j-f1, @lipis and @azz for the help in transferring this repository to the prettier organization.

Thanks to @Peilonrayz, who gave me the idea to rewrite the printer into a class and thus make the code a lot more maintainable.

Thanks to @lehni, @SkyaTura and @shadowgate15 for the massive contribution and the introduction of many new features into the project.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].