2017 © Pedro Peláez
 

project symfony-twig-extensions

image

treeleaf/symfony-twig-extensions

  • Sunday, May 8, 2016
  • by treeleafmedia
  • Repository
  • 1 Watchers
  • 0 Stars
  • 76 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

SymfonyTwigExtensions

This is a collection of Twig extensions that I use in symfony., (*1)

Grunt Asset Cache Bust

Extension when using Grunt plugin Cache Bust. See https://github.com/hollandben/grunt-cache-bust, (*2)

How to install

composer require treeleaf/symfony-twig-extensions

How to use in Symfony

In app/config/services.yml:, (*3)

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

In a twig template:, (*4)

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

Grunt

Example Gruntfile.js:, (*5)

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., (*6)

Example grunt-cache-bust.json:, (*7)

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

The Versions

08/05 2016

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

by Steven Poelmans

08/05 2016

v0.1

0.1.0.0

  Sources   Download

MIT

The Requires

 

by Steven Poelmans