diff --git a/baseframe/__init__.py b/baseframe/__init__.py index 2221d7eb..70ae65cf 100644 --- a/baseframe/__init__.py +++ b/baseframe/__init__.py @@ -137,6 +137,7 @@ def init_app( bundle_css=None, assetenv=None, theme='bootstrap3', + asset_modules=() ): """ Initialize an app and load necessary assets. @@ -248,6 +249,18 @@ def init_app( app.assets.register('css_all', css_all) app.register_blueprint(self, static_subdomain=subdomain) + for module_name in asset_modules: + try: + module = __import__(module_name) + module.blueprint.init_app(app) + app.register_blueprint( + module.blueprint, + url_prefix="/_baseframe", + static_subdomain=subdomain + ) + except ImportError: + app.logger.warning("Unable to import asset module: %s", module_name) + # Optional config for a client app to use a manifest file # to load fingerprinted assets # If used with webpack, the client app is expected to specify its own webpack.config.js