68publishers / webpack-encore-bundle v2.0

Nette integration with Webpack Encore!

download-cloud-line composer require 68publishers/webpack-encore-bundle

WebpackEncoreBundle: Nette integration with Webpack Encore!

Build Status Quality Score Coverage Status Total Downloads Latest Version on Packagist

This package is inspired by symfony/webpack-encore-bundle. This package allows you to use the splitEntryChunks() feature from Webpack Encore by reading an entrypoints.json file and helping you render all of the dynamic script and link tags needed.


The best way to install 68publishers/webpack-encore-bundle is using Composer:

composer require 68publishers/webpack-encore-bundle

This package requires integration with symfony/asset. We recommend using of our package 68publishers/asset but you can use your own integration.

then you can register extension into DIC:

    encore: SixtyEightPublishers\WebpackEncoreBundle\DI\WebpackEncoreBundleExtension


    # The path where Encore is building the assets - i.e. Encore.setOutputPath()
    output_path: %wwwDir%/public/build
    # If multiple builds are defined (as shown below), you can disable the default build with value NULL or omit this setting
    # if you have multiple builds:
        # pass "frontend" as the 3rg arg to the Latte Macros
        # {encore_js 'entry1', null, 'frontend'}
        frontend: %wwwDir%/public/frontend/build
    # if using Encore.enableIntegrityHashes() and need the crossorigin attribute (default: NULL, or use 'anonymous' or 'use-credentials')
    crossorigin: 'anonymous'
    # if you want to cache entrypoints.json
        enabled: yes # default is 'no'
        storage: @myStroage # default is @Nette\Caching\IStorage
    # if you want to change macro's names
        js_assets_macro_name: encore_js # default
        css_assets_macro_name: encore_css # default

Usage in Latte templates

{block javascripts }
    {include parent}

    {encore_js 'entry1'}

{block stylesheets}
    {include parent}

    {encore_css 'entry1'}


Before committing any changes, don't forget to run

vendor/bin/php-cs-fixer fix --config=.php_cs.dist -v --dry-run


vendor/bin/tester ./tests
  • v2.0 v2.0

    • upgrade to Nette 3.x
  • v1.1 v1.1 - Symfony 5 & PHP 7.2+

    • dropped support for PHP 7.1
    • supported versions ^4.2 and ^5.0 for Symfony Asset Component
    • improved coding style
    • improved CI configuration
  • v1.0 v1.0 - First release

    ✔️ Nette ^2.4

Componette Componette