承接 gradientz/twig-express-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

gradientz/twig-express-bundle

Composer 安装命令:

composer require gradientz/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.

README 文档

README

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!

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.

Installation

Install with Composer in your Symfony project:

composer require kaliop/twig-express-bundle

Then you will need to register this bundle in app/AppKernel.php. This may look like:

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.

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

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:

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.

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:

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:

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:

parameters:
    twig_express.url_base: something-different

统计信息

  • 总下载量: 1.26k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-09-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固