Skip to content

lyrixx/twig-include-syntax

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Twig Include Syntax

Bored to update twig include syntax by hand? Me too!

You don't understand what I'm talking about? Let me explain.

When you include a file in twig, you have to use the following syntax:

{{ include('path/to/file.html.twig') }}

It's semantically more correct, than the following syntax:

{% include 'path/to/file.html.twig' %}

So I made this application to apply this kind of changes:

 {% block header %}
-     {% include "_header.html.twig" %}
+     {{ include('_header.html.twig') }}
 {% endblock %}

It's build and packaged with Castor.

Installation

Go to the release page and download the latest version.

You don't even need PHP installed on your machine, just download the static binary file and you are ready to go.

Warning

  • This doesn't handle whitespace controls
  • It works on my projects, but it may not work on yours
  • There are no tests and the regex is quite complex

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages