2017 © Pedro Peláez
 

symfony-bundle twig-express-bundle

Browse and render “static” Twig templates from bundles in a Symfony project. This bundle is a port of the TwigExpress tool, and is intended for private front-end prototypes, not public-facing pages.

image

kaliop/twig-express-bundle

Browse and render “static” Twig templates from bundles in a Symfony project. This bundle is a port of the TwigExpress tool, and is intended for private front-end prototypes, not public-facing pages.

  • Monday, June 12, 2017
  • by gggeek
  • Repository
  • 2 Watchers
  • 0 Stars
  • 148 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 14 % Grown

The README.md

KaliopTwigExpressBundle

Browse and render “static” Twig templates in a Symfony project. This bundle is a port of the TwigExpress standalone tool, and is intended for private front-end prototypes. You might like it if you’re a designer or front-end developer working with Symfony. Do not use this bundle or its routes in production!, (*1)

Features

  1. Gives access to the Twig templates in the Resources/views/static folder of a bundle, showing index pages for this folder and subfolders. (Note that the root folder can be changed for each bundle.)
  2. Renders Twig templates, and reports Twig errors with an extract of the faulty template.

Important: this bundle’s controller will not be able to render templates that depend on data provided by other existing controllers. It’s intended for “static” prototypes which don’t depend on any data from databases or services., (*2)

Installation

Install with Composer in your Symfony project:, (*3)

composer require kaliop/twig-express-bundle

Then you will need to register this bundle in app/AppKernel.php. This may look like:, (*4)

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            /* ... */
            new Kaliop\TwigExpressBundle\KaliopTwigExpressBundle(),
        ];
    }
}

Getting started

Let’s say you have a bundle named MyAwesomeBundle and which contains “static” Twig templates in MyAwesomeBundle/Resources/views/static. By “static” Twig templates, we mean templates which do not depend on data provided by a controller. It could be simple HTML pages with {% include %} tags and other native Twig features., (*5)

First you will need to activate the TwigExpress routes. Add this to your routing config (for example in routing_dev.yml):, (*6)

twig_express:
    resource: "@KaliopTwigExpressBundle/Resources/config/routing.yml"

Then, in your main config (for example in config_dev.yml), tell KaliopTwigExpressBundle that it can render templates from your bundle:, (*7)

twig_express:
    bundles:
        -   MyAwesomeBundle

Finally, navigate to http://[your-hostname]/static/ to explore your static views. You should be able to explore and render the Twig templates from MyAwesomeBundle/Resources/views/static., (*8)

Demo pages

This bundle contains its own demo static templates, which demonstrate a few added features. To activate it, add this import to your config_dev.yml:, (*9)

imports:
    - resource: "@KaliopTwigExpressBundle/Resources/config/demo.yml"

Advanced configuration

For each bundle, instead of providing the bundle’s name only, you can change the URL slug (the part that identifies this bundle in the URL) and the path to the bundle’s “static” templates:, (*10)

twig_express:
    bundles:
        # 'name' is required and must be a valid bundle name;
        # 'root' defaults to 'Resources/views/static';
        # 'slug' will use an automatic value if not defined.
        -   name: MyStaticBundle
            root: Resources/views/static-html
            slug: ohmy
        -   name: AwesomeStaticBundle
            root: Resources/components
            slug: awesome

If you would like to use a different URL base than /static/…, use the twig_express.url_base parameter:, (*11)

parameters:
    twig_express.url_base: something-different

The Versions

12/06 2017

dev-master

9999999-dev

Browse and render “static” Twig templates from bundles in a Symfony project. This bundle is a port of the TwigExpress tool, and is intended for private front-end prototypes, not public-facing pages.

  Sources   Download

MIT

The Requires

 

12/06 2017

3.1.0

3.1.0.0

Browse and render “static” Twig templates from bundles in a Symfony project. This bundle is a port of the TwigExpress tool, and is intended for private front-end prototypes, not public-facing pages.

  Sources   Download

MIT

The Requires

 

31/05 2017

3.0.0

3.0.0.0

Browse and render “static” Twig templates from bundles in a Symfony project. This bundle is a port of the TwigExpress tool, and is intended for private front-end prototypes, not public-facing pages.

  Sources   Download

MIT

The Requires

 

24/11 2016

2.0.4

2.0.4.0

Browse and render “static” Twig templates from bundles in a Symfony project. This bundle is a port of the TwigExpress tool, and is intended for private front-end prototypes, not public-facing pages.

  Sources   Download

MIT

The Requires

 

24/11 2016

2.0.3

2.0.3.0

Browse and render “static” Twig templates from bundles in a Symfony project. This bundle is a port of the TwigExpress tool, and is intended for private front-end prototypes, not public-facing pages.

  Sources   Download

MIT

The Requires

 

03/10 2016

2.0.2

2.0.2.0

Browse and render “static” Twig templates from bundles in a Symfony project. This bundle is a port of the TwigExpress tool, and is intended for private front-end prototypes, not public-facing pages.

  Sources   Download

MIT

The Requires

 

26/09 2016

2.0.1

2.0.1.0

Browse and render “static” Twig templates from bundles in a Symfony project. This bundle is a port of the TwigExpress tool, and is intended for private front-end prototypes, not public-facing pages.

  Sources   Download

MIT

The Requires

 

23/09 2016

2.0.0

2.0.0.0

Browse and render “static” Twig templates from bundles in a Symfony project. This bundle is a port of the TwigExpress tool, and is intended for private front-end prototypes, not public-facing pages.

  Sources   Download

MIT

The Requires

 

19/09 2016

1.0.0

1.0.0.0

Browse and render “static” Twig templates from bundles in a Symfony project. This bundle is a port of the TwigExpress tool, and is intended for private front-end prototypes, not public-facing pages.

  Sources   Download

MIT

The Requires