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

Assets Push Bundle Laravel Package

braunstetter/assets-push-bundle

View on GitHub
Deep Wiki
Context7

AssetsPushBundle

Scrutinizer Code Quality Build Status Total Downloads License

Push your assets from everywhere inside your templates into the <head>.

Installation

composer require braunstetter/assets-push-bundle

Usage

After the installation you can use the two tags from each template to register additional resources.

{% css '/breadcrumbs.css' %}
{% js '/breadcrumbs.js' %}

After that you are able to query the assets with the assets() function.

It will give you an array of assets like that:

[
    'css' => [
        '/breadcrumbs.css',
        '/custom.css',
        '/app.css',
    ],
    
    'js' => [
        '/breadcrumbs.js'
    ],
]

Now you can use this on top of your pages:


<head>
    <meta charset="UTF-8">
    <title>{% block title %}Welcome!{% endblock %}</title>

    {% block metadata %}{% endblock %}
    
    {% block pushedJs deferred %}
    {% for asset in assets()['js'] %}
        <script src="{{ asset(asset) }}" defer></script>
    {% endfor %}
    {% endblock %}

    {% block pushedCSS deferred %}
    {% for asset in assets()['css'] %}
        <link rel="stylesheet" href="{{ asset(asset) }}">
    {% endfor %}
    {% endblock %}
</head>

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.
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator