2017 © Pedro Peláez
 

library twig-static

A filter that takes a static file path and returns a URL versioned with the file hash

image

fffunction/twig-static

A filter that takes a static file path and returns a URL versioned with the file hash

  • Monday, July 10, 2017
  • by danreeves
  • Repository
  • 4 Watchers
  • 1 Stars
  • 17 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 13 % Grown

The README.md

twig-static

Build Status, (*1)

composer require fffunction/twig-static

Usage

Add the filter to Twig:, (*2)

$twig->addFilter('static', new Twig_Filter_Function(
    create_static_filter('path/to/assets/', '/url/to/prepend/')
));

Then pass paths to the filter in your templates:, (*3)

{{ 'js/app.bundle.js' | static }}
{# /url/to/prepend/js/app.bundle.js?v=1a2b3c4 #}

API

create_static_filter(sting $asset_root, string $asset_url): function - $asset_root: a relative path from the app root to the assets root dir - $asset_url: a path to prepend to the returned url, (*4)

The Versions

10/07 2017

dev-master

9999999-dev

A filter that takes a static file path and returns a URL versioned with the file hash

  Sources   Download

MIT

The Development Requires

by Dan Reeves

07/07 2017

1.0.0

1.0.0.0

A filter that takes a static file path and returns a URL versioned with the file hash

  Sources   Download

MIT

The Development Requires

by Dan Reeves