Deployment

For production, move from the zero-config CDN to AssetMapper: pin your packages into the importmap, compile, and serve the hashed assets. The bundle's demo additionally ships as a fully static HTML export.

1. Pin the assets

Require the runtime packages into your importmap so they are served from your own domain rather than jsDelivr:

php bin/console importmap:require bootstrap admin-lte bootstrap-icons/font/bootstrap-icons.min.css

2. Import the behaviour entrypoint

// assets/app.js
import '@colorlibhq/adminlte-symfony/adminlte.js'; // Bootstrap + AdminLTE behaviour

This loads Bootstrap and AdminLTE's JavaScript (sidebar toggle, treeview, card tools, fullscreen).

3. Emit the importmap in your layout

Override the base layout's asset blocks so production builds use the compiled bundle instead of CDN tags:

{% extends '@AdminLte/layout.html.twig' %}

{% block stylesheets %}
    {{ importmap('app') }}
{% endblock %}

{% block javascripts %}
    {# importmap('app') above already wires JS; add page-specific scripts here #}
{% endblock %}

4. Compile for production

# Warm the cache and compile the asset map + importmap
php bin/console cache:clear --env=prod
php bin/console asset-map:compile --env=prod

This writes the hashed, content-versioned assets into public/assets/, ready to be served by your web server or a CDN in front of it.

AssetMapper is the recommended path — no Webpack Encore and no Node build are required. The CDN setup is fine for prototypes and demos, but local assets give you versioning, caching and offline reliability.

Static export (the demo)

The bundle's demo at adminlte-symfony.pages.dev is generated as a fully static HTML site. A small DemoKernel boots the bundle with a complete sidebar menu and renders every demo template to plain .html files. Because the demo layout pulls CSS/JS from the jsDelivr CDN, the output is self-contained and deployable to a static host such as Cloudflare Pages.

This is a useful reference pattern: if your app is read-only or screenshot-driven, you can render the AdminLTE templates to static HTML the same way rather than running PHP at request time.

Remember to set a real color_mode default and a production title in config/packages/admin_lte.yaml before deploying — these feed the SSR-safe theme script and the <title> tag.


AdminLTE 4 · Symfony port Edit on GitHub