twig integration

28
Twig Integration Magic or “How to successfully implement a large feature in no time”

Upload: thijs-de-paepe

Post on 08-Aug-2015

48 views

Category:

Technology


0 download

TRANSCRIPT

Twig Integration Magicor “How to successfully implement a large feature in no time”

Find me @

- [email protected] - twitter #Thijzer- instagram #thijsdp- https://github.com/Thijzer- ICQ # 1079428- https://plus.google.com/108354583103011120629

Twig Integration : Topics

- Twig Magic- Diff : Twig | Spoon- Syntax Filters, Modifiers, Form object, BC- spoon2twig command- Up next

Ingredients of “How to successfully implement a large feature in no time”

Ingredient # 1Do your Research Before You start

especially on the show stoppers

Ingredient # 2The Eureka Moment

Ingredient # 3KISS

your Proof of Concept

Ingredient # 4 SHARE & CONTRIBUTE

Result :

Twig Integration POC was a 1 day build

NO SUCH THING

ONLY THE HARD EFFORT FROM YOU AND OTHERS GETS BY

Diff : Twig | Spoon

Diff Twig <> Spoon- Twig is slightly faster in compile time- Twig caches better- Dev friendly and widely used syntax (Jinja, Django)- Twig is still being developed- works with existing actions, modules- no changes needed in your files- syntax highlighting in your IDE- Awesome Documentation

Fully Backwards Compatible

Parameter added fork.template twig | spoon

Warning!

This integration is still in review. Things might change.

Twig uses Moustache variables

-> {$variable}-> {{ variable }}

Spoon Globals have the same name (BC){$LANGUAGE} -> {{ LANGUAGE }}

Twig operators

-> {option:hasValue}{/option:hasValue}-> {% if hasValue %}{% endif %} …

-> {iteration:values}{/iteration:values}-> {% for value in values %}{% endfor %}

Twig uses Spoon Modifiers Filters

All spoon modifiers are accessible

-> {$var|getnavigation:'page':0:1}-> {{ var|getnavigation('page', 0, 1)|raw }}

Twig : Filters

All spoon filters are accessible with some exceptions

-> {$lblEmail|ucfirst} -> {{ lbl.Email|capitalize }}-> |raw for html encoding

Twig : Options

Twig : Options

Form Object by Per

Spoon2Twig Converter

spoon2twig converter

- converts all your tpl files into twig files- 99.999% something accurate :)- no positions :/- converts individual files- a forced option if twig file is present- yes it even converts an iteration in iteration- depluralize and shortens your iterations

spoon2twig converter

php tools/spoon2twig.php path -t *-m *-f

php tools/spoon2twig.php -t *-f bootstrap php tools/spoon2twig.php all

* not ready

Up Next For Twig

Up Next :

- We want OBJECTS!!- Twig is Frontend Only (for now)- Spoon2twig commands for specific themes

or modules

Questions?

https://joind.in/talk/view/14610