symfony2admingenerator / GeneratorBundle

Admingenerator for Symfony. Parse YAML files to build customized backend.
MIT License
67 stars 29 forks source link

Whitespace control in templates #40

Open ioleo opened 9 years ago

ioleo commented 9 years ago

The code rendered from templates is hard to control, due to lack of proper whitespace control in Twig.

I've pushed a PR which addresses that issue in Twig. If it is merged, we should review the templates and use the new whitespace control operator where needed.

sescandell commented 9 years ago

:+1:

sescandell commented 9 years ago

After some discussions, we emit the idea about using PHP CS-Fixer (on dev environment only).

This will effectively handle PHP files... but not Twig ones... Does any one know a Java or PHP script or anything else to auto-format Twig files?

ioleo commented 9 years ago

Actually auto-formatting twig templates... may be impossible.

How does the formating tool know if:

{% block abc %}I am
broken into
three lines{% endblock %}

is on purpose (part of the design) or a byproduct of lacking whitespace control (and should be fixed)?

sescandell commented 9 years ago

Actually some IDE do it... so it should be possible... No?

ioleo commented 9 years ago

I've done a little research. I could not find any TWIG "format" or "prettify" library. We'd have to write our own.