定制 treeleaf/symfony-twig-extensions 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

treeleaf/symfony-twig-extensions

最新稳定版本:v0.1

Composer 安装命令:

composer create-project treeleaf/symfony-twig-extensions

包简介

README 文档

README

This is a collection of Twig extensions that I use in symfony.

Grunt Asset Cache Bust

Extension when using Grunt plugin Cache Bust. See https://github.com/hollandben/grunt-cache-bust

How to install

composer require treeleaf/symfony-twig-extensions

How to use in Symfony

In app/config/services.yml:

services:
  my_app.twig.grunt_cache_bust:
    class: Treeleaf\Twig\Extension\GruntAssetCacheBust
    public: false
    tags:
        - { name: twig.extension }

In a twig template:

<script src="/{{ gruntCacheBust('grunt-cache-bust.json', 'js/app.js') }}"></script>

Grunt

Example Gruntfile.js:

cacheBust: {
    options: {
        assets: ['css/*', 'js/*']
    },
    all: {
        options: {
            expand: true,
            queryString: true,
            jsonOutput: true
        },
        src: ['/js/**/*.js', '/css/**/*.css']
    }
}

This will by default generate a json artefact grunt-cache-bust.json with a mapping of the source file and the hashed file.

Example grunt-cache-bust.json:

{
    "js/vendor.js":"js/vendor.js?82f8fc4bb7e495e6",
    "js/app.js":"js/app.js?4df6c65674ecfa3d",
    "css/main.css":"css/main.css?362da3994e41aa48"
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-05-07