Skip to content
Nette integration with Webpack Encore! https://symfony.com/webpack-encore
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests
.gitattributes
.gitignore
.php_cs.dist
.scrutinizer.yml
.travis.yml
LICENSE.md
README.md
composer.json

README.md

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.

Installation

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:

extensions:
    encore: SixtyEightPublishers\WebpackEncoreBundle\DI\WebpackEncoreBundleExtension

Confiugration

encore:
    # 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:
    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
    cache:
        enabled: yes # default is 'no'
        storage: @myStroage # default is @Nette\Caching\IStorage
    
    # if you want to change macro's names
    latte:
        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}

{block stylesheets}
    {include parent}

    {encore_css 'entry1'}
{/block}

Contributing

Before committing any changes, don't forget to run

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

and

vendor/bin/tester ./tests
You can’t perform that action at this time.