Nette integration with Webpack Encore! https://symfony.com/webpack-encore

v2.0 2020-10-27 22:37 UTC

This package is auto-updated.

Last update: 2021-04-27 23:50:42 UTC


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