prettier / prettier/plugin-php

Format PHP + HTML + JS + CSS at once? (Wordpress)

Open
#846 16 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

discussion enhancement
Dominant language
PHP
Stars
1.9k
Forks
139
PR merge metrics
No merged PRs in 30d

Description

Will it be/is it possible when using prettier + the coming PHP plugin, to prettify a .php file that contains php + html + inline js (<script>) + inline css (<style>)?

Atm I am using phpcs + eslint at the moment, which struggle and output a complete chaos of indentation unless it was already correct (& even then they sometimes mess it up, if its a mixed file, like it's often encountered in WP core & plugins)

I am available for testing & can supply some test files that were absolutely butchered by phpcsfixer/eslint, just let me know how I can help.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named. Start by reviewing how the plugin currently handles mixed PHP, HTML, inline JavaScript, and inline CSS, then use representative WordPress files such as the examples the reporter can provide. Done means mixed .php files are formatted without the indentation problems described, with coverage for the supported combinations.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, html, javascript, php
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.