2017 © Pedro Peláez
 

symfony-bundle webpack-bundle

A Symfony bundle to create paths to webpack assets in your Twig templates.

image

freshheads/webpack-bundle

A Symfony bundle to create paths to webpack assets in your Twig templates.

  • Thursday, March 22, 2018
  • by freshheads
  • Repository
  • 5 Watchers
  • 1 Stars
  • 2,107 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 26 % Grown

The README.md

FHWebpackBundle

A Symfony bundle to create paths to webpack assets in your Twig templates. This bundle uses the webpack statistics file to find the newest assets for a given webpack entry., (*1)

Installation

Install with composer:, (*2)

composer require freshheads/webpack-bundle

Register the bundle

// config/bundles.php
return [
    // ...
    FH\Bundle\WebpackBundle\FHWebpackBundle::class => [ 'all' => true ]
];

Configuration

All configuration options, with default values:, (*3)

fh_webpack:
    stats_filename: stats.json
    # web/document root, assets will be referenced from this path
    web_dir: '%kernel.project_dir%/public'

Usage

<link rel="stylesheet" href="{{ webpack_asset('assets/frontend/build', 'app', 'css') }}" />
<script type="text/javascript" src="{{ webpack_asset('assets/frontend/build', 'app', 'js') }}"></script>

Dump the contents of a webpack file

<style type="text/css">
    {{ webpack_asset_contents('assets/frontend/build', 'email', 'css')|raw }}
</style>

Requirements

This library works with PHP version 8.1 and up., (*4)

The Versions