echo511/gaufrette

There is no license information available for the latest version (v1.0.1) of this package.

Installs: 56

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

Type:project

v1.0.1 2014-09-19 12:03 UTC

This package is not auto-updated.

Last update: 2024-12-17 03:09:41 UTC


README

Installation

Install using composer:

$ composer require echo511/gaufrette:~1.0@dev

Register compiler extension using config.neon

extensions:
	gaufrette: Echo511\Gaufrette\DI\GaufretteExtension

Configure in config.neon

gaufrette:
	# Folder for asset copies
	assets:
		directory: '.../assets'
		web: '<basePath>/assets'

	# Data directory (uploaded photos/pdfs/etc.)
	data:
		directory: '.../data'
		web: '<basePath>/data'

Make sure your compiler extension class implements Echo511\Gaufrette\DI\IAssetsProvider.

Usage

To access assets use Echo511\Gaufrette\Assets\ExtensionsAssets or macro Echo511\Gaufrette\Assets\AssetMacro.

To access data use Echo511\Gaufrette\Data\DataFilesystem.

Asset macro

In presenter:

<?php

use Nette\Application\UI\Presenter;
use Echo511\Plupload\Entity\UploadQueue;

class HomePresenter extends Presenter
{

	/** @var AssetMacro @inject */
	public $assetMacro;


	public function createTemplate()
	{
		$template = parent::createTemplate();
		$this->assetMacro->register($template, 'asset', MyCompilerExtension::class);
		return $template;
	}

}

In templates then use:

<link href="{asset 'css/bootstrap.min.css'}" rel="stylesheet">