Plugins
Reflex supports a plugin system that allows you to extend the framework's functionality during the compilation process. Plugins can add frontend dependencies, modify build configurations, generate static assets, and perform custom tasks before compilation.
Configuring Plugins
Plugins are configured in your rxconfig.py file using the plugins parameter:
Built-in Plugins
Reflex comes with several built-in plugins that provide common functionality.
SitemapPlugin
The SitemapPlugin automatically generates a sitemap.xml file for your application, which helps search engines discover and index your pages.
The sitemap plugin automatically includes all your app's routes. For dynamic routes or custom configuration, you can add sitemap metadata to individual pages:
The sitemap configuration supports the following options:
loc: Custom URL for the page (required for dynamic routes)lastmod: Last modification date (datetime object)changefreq: How frequently the page changes ("always","hourly","daily","weekly","monthly","yearly","never")priority: Priority of this URL relative to other URLs (0.0 to 1.0)
TailwindV4Plugin
The TailwindV4Plugin provides support for Tailwind CSS v4, which is the recommended version for new projects and includes performance improvements and new features.
You can customize the Tailwind configuration by passing a config dictionary:
TailwindV3Plugin
The TailwindV3Plugin integrates Tailwind CSS v3 into your Reflex application. While still supported, TailwindV4Plugin is recommended for new projects.
You can customize the Tailwind configuration by passing a config dictionary:
Plugin Management
Default Plugins
Some plugins are enabled by default. Currently, the SitemapPlugin is enabled automatically. If you want to disable a default plugin, use the disable_plugins parameter:
Plugin Order
Plugins are executed in the order they appear in the plugins list. This can be important if plugins have dependencies on each other or modify the same files.
Plugin Architecture
All plugins inherit from the base Plugin class and can implement several lifecycle methods:
Creating Custom Plugins
You can create custom plugins by inheriting from the base Plugin class:
Then use it in your configuration: