2017 © Pedro Peláez
 

symfony-bundle hashed-asset-bundle

Apply an asset version based on a hash of the asset for symfony/asset

image

incenteev/hashed-asset-bundle

Apply an asset version based on a hash of the asset for symfony/asset

  • Saturday, July 14, 2018
  • by Stof
  • Repository
  • 4 Watchers
  • 20 Stars
  • 20,589 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 4 Versions
  • 32 % Grown

The README.md

HashedAssetBundle

The HashedAssetBundle provides an asset version strategy which uses a hash of the file content as asset version. This allows bumping the asset version separately for each asset (automatically)., (*1)

CI Total Downloads Latest Stable Version, (*2)

Installation

Use Composer to install the bundle:, (*3)

$ composer require incenteev/hashed-asset-bundle

Usage

Register the bundle in the kernel:, (*4)

// app/AppKernel.php

// ...

class AppKernel extends Kernel {
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Incenteev\HashedAssetBundle\IncenteevHashedAssetBundle(),
        );
    }
}

Then configure FrameworkBundle to use the new version strategy:, (*5)

framework:
    assets:
        version_strategy: incenteev_hashed_asset.strategy

Advanced configuration

The default configuration should fit common needs, but the bundle exposes a few configuration settings in case you need them:, (*6)

incenteev_hashed_asset:
    # Absolute path to the folder in which assets can be found
    # Note: in case you apply a base_path in your asset package, it is not
    # yet applied to the string received by the bundle
    web_root: '%kernel.project_dir%/web'
    # Format used to apply the version. This is equivalent to the
    # `framework > assets > version_format` of the static version strategy
    # of FrameworkBundle.
    version_format: '%%s?%%s'

License

This bundle is under the MIT license., (*7)

Alternative projects

If you want to apply cache busting by renaming files in your asset pipeline (for instance with the webpack-encore versioning feature), have a look at the json_manifest strategy available in Symfony itself., (*8)

Reporting an issue or a feature request

Issues and feature requests are tracked in the Github issue tracker., (*9)

The Versions

14/07 2018

dev-master

9999999-dev

Apply an asset version based on a hash of the asset for symfony/asset

  Sources   Download

MIT

The Requires

 

The Development Requires

bundle symfony assets symfony-bundle cache-busting

25/05 2018
21/02 2018
09/06 2017

v1.0.0

1.0.0.0

Apply an asset version based on a hash of the asset for symfony/asset

  Sources   Download

MIT

The Requires

 

The Development Requires

bundle symfony assets symfony-bundle cache-busting