Componette

Componette

vodickavaclav

vodickavaclav / nette-encore

Integration of @symfony/webpack-encore into Nette project.

download-cloud-line composer require vavo/nette-encore

Nette Encore

Macros and components for integration of Encore into Nette project.

Install

composer require vavo/nette-encore
yarn add @symfony/webpack-encore --dev

Usage

1 . Register extension.

extensions:
	encoreLoader: vavo\EncoreLoader\DI\EncoreLoaderExtension

2 . Define encore properties in config.

encoreLoader:
    outDir: "%wwwDir%/build/"
    defaultEntry: index

3 . Add trait into Presenter.

<?php

declare(strict_types=1);

namespace App\Presenters;

use vavo\EncoreLoader\EncoreLoaderTrait;
use Nette;

class BasePresenter extends Nette\Application\UI\Presenter
{
	use EncoreLoaderTrait;
...

4 . Add control into @layout.latte. You can specify what file should be included.

{control encore-css}
{control encore-css, [filename]}
...
{control encore-js, index}

5 . Use latte macro anywhere you need.

<img src="https://raw.github.com/vodickavaclav/nette-encore/HEAD/{asset "build/images/logo.svg"}" />

6 . Use relative path to your image in css

background-image: url('../images/background.jpg')

No release at this moment. Try to create first one.

bar-chart-fill

Statistics

download-cloud-fill
1556
star-fill
0
bug-fill
1
flashlight-fill
89d
price-tag-2-line

Badges

guide-fill

Dependencies

ext-curl (*)
php (>= 7.4)
nette/di (^3.0)
Componette Componette felix@nette.org