Skip to content

📂 Intergration of Symfony's Assets component into Nette Framework

License

Notifications You must be signed in to change notification settings

68publishers/asset

Repository files navigation

Symfony Asset Component in Nette

Integration of symfony/asset into Nette Framework.

Checks Coverage Status Total Downloads Latest Version PHP Version

Installation

The best way to install 68publishers/asset is using Composer:

$ composer require 68publishers/asset

Usage

Simply register a compiler extension into DIC:

extensions:
	asset: SixtyEightPublishers\Asset\Bridge\Nette\DI\AssetExtension

asset:
	# your configuration

Configuration options are described in official Symfony documentation

Usage in Latte templates

{* Use default package *}
<img src="{asset 'my/awesome/image.png'}" alt="..."></a>
<p>Version: {asset_version 'my/awesome/image.png'}</p>


{* Use "foo" package *}
<img src="{asset 'my/awesome/image.png', 'foo'}" alt="..."></a>
<p>Version: {asset_version 'my/awesome/image.png', 'foo'}</p>

You can also use a function equivalent. For example if you want to store result in variable:

{var $asset = asset('my/awesome/image.png')}
{var $asset = asset('my/awesome/image.png', 'foo')}

{var $version = asset_version('my/awesome/image.png')}
{var $version = asset_version('my/awesome/image.png', 'foo')}

Contributing

Before opening a pull request, please check your changes using the following commands

$ make init # to pull and start all docker images

$ make cs.check
$ make stan
$ make tests.all