jade-php-twig
jade with php inspired in twig
install
npm install jade-php-twig --save-dev
usage
var gulp = ;var gulpJade = ;var jadePhpTwig = ;gulp
the problem
integration with php is bad, does not respect indenting
.content li(data-id!="") hello <!-- indent? -->
examples
variable in text
div.myclass hello {{ $world }} php//- result//- <div class="myclass"> hello <?php echo $world; ?> php</div>
variable in attributes
div.myclass(data-test!="{{ $var }}") hello {{ $world }} php//- result//- <div data-test="<?php echo $var; ?>" class="myclass"> hello <?php echo $world; ?> php</div>
variable in pipe text
div.myclass(data-test!="{{ $var }}") hello {{ $world }} php | new line | line with php {{ $test }}//- result//- <div data-test="<?php echo $var; ?>" class="myclass"> //- hello <?php echo $world; ?> php//- new line//- line with php <?php echo $test; ?>//- </div>
structures of control and conditional
structure foreach
.content {% foreach($users as $user): %} div hello {{ $user }} {% endforeach %}//- result//- <div class="content">//- <?php foreach($sers as $user): ?> //- <div> hello <?php echo $yser; ?></div>//- <?php endforeach; ?>//- </div>
conditional
.content {% if(true): %} div is true {% else: %} div is false {% endif %}//- result//- <div class="content">//- <?php if(true): ?> //- <div>is true</div>//- <?php else: ?>//- <div>is false</div>//- <?php endif; ?>//- </div>