You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using jsbeautify on mixed PHP/CSS/JS/HTML. PHP open/close tags inside script blocks get spaces inserted between the characters. I don't expect the PHP to be formatted itself, but is it possible for the tags to remain intact? It makes it easy to then find and replace with the original PHP content after formatting.
Input
The code looked like this before beautification:
<script>
var foo = <?php ?>;
var bar = <?= ?>;
</script>
Expected Output
The code should have looked like this after beautification:
<script>
var foo = <?php ?>;
var bar = <?= ?>;
</script>
Actual Output
The code actually looked like this after beautification:
<script>
var foo = < ? php ? > ;
var bar = < ? = ? > ;
</script>
Steps to Reproduce
var format = require('js-beautify');
var fs = require('fs');
var src = fs.readFileSync('./test.php').toString();
fs.writeFileSync('./formatted.php', format.html(src));
See #1647 . The area inside the script is considered javascript and processed as such.
If you have a suggestion as to how to improve the readme to make this more discoverable, I would appreciate a PR.
Description
I'm using jsbeautify on mixed PHP/CSS/JS/HTML. PHP open/close tags inside script blocks get spaces inserted between the characters. I don't expect the PHP to be formatted itself, but is it possible for the tags to remain intact? It makes it easy to then find and replace with the original PHP content after formatting.
Input
The code looked like this before beautification:
Expected Output
The code should have looked like this after beautification:
Actual Output
The code actually looked like this after beautification:
Steps to Reproduce
Environment
OS:
Linux xps 4.9.0-9-amd64 #1 SMP Debian 4.9.168-1+deb9u3 (2019-06-16) x86_64 GNU/Linux
Settings
default settings
The text was updated successfully, but these errors were encountered: