juniwalk / tessa
v2.2.3
2024-06-05 11:09 UTC
Requires
- php: >=8.1
- juniwalk/utils: ^3.0|^4.0
- nette/application: >=2.4 <4.0
- nette/di: >=2.4 <4.0
- nette/schema: ^1.0
Requires (Dev)
- nette/bootstrap: ^3.2
- nette/tester: ^2.5
- phpstan/extension-installer: ^1.0
- phpstan/phpstan: ^1.0
- phpstan/phpstan-nette: ^1.0
- scssphp/scssphp: ^1.0
- staabm/phpstan-todo-by: ^0.1
- symfony/console: ^7.0
- tracy/tracy: ^2.10
Suggests
- scssphp/scssphp: Enables compiling of SCSS files using ScssFilter.
README
To install latest version of juniwalk/tessa
use Composer.
composer require juniwalk/tessa
Usage
Check config.neon from tests for more details.
extensions: tessa: JuniWalk\Tessa\DI\TessaExtension tessa: outputDir: %wwwDir%/static checkLastModified: true default: defer: true assets: - %moduleDir%/font-awesome/css/font-awesome.min.css - %moduleDir%/jquery/dist/jquery.min.js - %moduleDir%/bootstrap/dist/css/bootstrap.min.css - %moduleDir%/bootstrap/dist/js/bootstrap.min.js - %moduleDir%/nette-forms/src/assets/netteForms.min.js - %wwwDir%/assets/style.css - %wwwDir%/assets/index.js frontend: extend: default assets: [] backend: extend: default assets: - %wwwDir%/assets/admin.js fullcalendar: defer: true assets: - %moduleDir%/fullcalendar/index.global.min.js
Include AssetManager
trait to get access to Tessa component.
use JuniWalk\Tessa\Attributes\AssetBundle; use JuniWalk\Tessa\Traits\AssetManager; #[AssetBundle('frontend')] class TessaPresenter extends Presenter { use AssetManager; #[AssetBundle('calendar')] public function actionCalendar(): void {} }
Then render styles and scripts in template from Presenter attributes.
<!DOCTYPE html> <html> <head> <title>Tessa example</title> {control tessa:css} {control tessa:js} </head> <body> <!-- your page content --> </body> </html>
Alternatively you can render specific part of bundle.
<!DOCTYPE html> <html> <head> <title>Render just fullcalendar scripts</title> {control tessa:js 'fullcalendar'} </head> <body> <!-- your page content --> </body> </html>