Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Twigfilesgetter Laravel Package

eltharin/twigfilesgetter

View on GitHub
Deep Wiki
Context7

Symfony TwigFilesGetter Bundle

Latest Stable Version Total Downloads Latest Unstable Version License

Installation

  • Require the bundle with composer:
composer require eltharin/twigfilesgetter

What is TwigFilesGetter Bundle?

This bundle will help you to include css and js files once in your template.

Per example, when you make a Custom FormType who need a script, you can put in the buildView function the lines :

use Eltharin\TwigFilesGetterBundle\Service\FileManager;

...

public function buildView(FormView $view, FormInterface $form, array $options)
{
    FileManager::registerJsFile('/bundles/eltharinreloadablefield/js/reloader.js');
    ...
}

or in a twig template :


{% do addJs('/bundles/eltharinreloadablefield/js/reloader.js') %} 

or

{% do addCss('fichier.css') %}

or with a group : 

{% do addJs('fichier.js', 'group Name') %}

and in your template :

{{ get_required_js_files() }}

will write

<script src="/bundles/eltharinreloadablefield/js/scripts.js"/></script>

if you want have js in head and after the page you can specify a 'group'

public function buildView(FormView $view, FormInterface $form, array $options)
{
    FileManager::registerJsFile('/bundles/eltharinreloadablefield/js/file_in_head.js', 'head');
    FileManager::registerJsFile('/bundles/eltharinreloadablefield/js/file_bottom.js', 'bottom');
    ...
}

and in your template :

in head : 

{{ get_required_js_files('head') }}

and 

{{ get_required_js_files('bottom') }}

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings