API Docs¶
Webpack integration for Flask.
-
class
flask_webpackext.ext.FlaskWebpackExt(app=None)[source]¶ Flask-WebpackExt extension.
Extension initialization.
Proxies¶
Proxy to current extension.
-
flask_webpackext.proxies.current_manifest= <LocalProxy unbound>¶ Proxy to current manifest.
-
flask_webpackext.proxies.current_webpack= <LocalProxy unbound>¶ Proxy to current extension.
Manifest¶
Proxy to current extension.
-
class
flask_webpackext.manifest.JinjaManifest[source]¶ Manifest entry which marks rendered strings as safe for Jinja.
Initialize manifest.
-
class
flask_webpackext.manifest.JinjaManifestEntry(name, paths)[source]¶ Manifest entry which marks rendered strings as safe for Jinja.
Initialize manifest entry.
Project¶
Webpack project utilities for Flask-WebpackExt.
-
class
flask_webpackext.project.WebpackBundleProject(import_name, project_folder=None, bundles=None, config=None, config_path=None)[source]¶ Flask webpack bundle project.
Initialize templated folder.
Parameters: - import_name – Name of the module where the WebpackBundleProject
class is instantiated. It is used to determine the absolute path
to the
project_folder. - project_folder – Relative path to the Webpack project which is
going to aggregate all the
bundles. - bundles – List of
flask_webpackext.bundle.WebpackBundle. This list can be statically defined if the bundles are known before hand, or dinamically generated usingpywebpack.helpers.bundles_from_entry_point()so the bundles are discovered from the defined Webpack entrypoints exposed by other modules. - config – Dictionary which overrides the
config.jsonfile generated by Flask-WebpackExt. Use carefuly and only if you know what you are doing sinceconfig.jsonis the file that holds the key information to integrate Flask with Webpack. - config_path – Path where Flask-WebpackExt is going to write the
config.json, this file is generated byflask_webpackext.project.flask_config().
- import_name – Name of the module where the WebpackBundleProject
class is instantiated. It is used to determine the absolute path
to the
-
class
flask_webpackext.project.WebpackTemplateProject(import_name, project_folder=None, config=None, config_path=None)[source]¶ Flask webpack template project.
Initialize project.
Parameters: - import_name – Name of the module where the
WebpackTemplateProject class is instantiated. It is used to
determine the absolute path to the
project_folder. - project_folder – Relative path to the Webpack project.
- config – Dictionary which overrides the
config.jsonfile generated by Flask-WebpackExt. Use carefuly and only if you know what you are doing sinceconfig.jsonis the file that holds the key information to integrate Flask with Webpack. - config_path – Path where Flask-WebpackExt is going to write the
config.json, this file is generated byflask_webpackext.project.flask_config().
- import_name – Name of the module where the
WebpackTemplateProject class is instantiated. It is used to
determine the absolute path to the
-
flask_webpackext.project.flask_config()[source]¶ Flask configuration injected in Webpack.
Returns: Dictionary which contains the information Flask-WebpackExt knows about a Webpack project and the absolute URLs for static files and assets. The dictionary consists of a key buildwith the following keys inside:debug: Boolean which represents if Flask debug is on.context: Absolute path to the generated assets directory.assetsPath: Absolute path to the generated static directory.assetsURL: URL to access the built files.staticPath: Absolute path to the generated static directory.staticURL: URL to access the static files..
Bundle¶
Webpack bundle APIs for Flask-WebpackExt.
-
class
flask_webpackext.bundle.WebpackBundle(import_name, folder, **kwargs)[source]¶ Flask webpack bundle.
Initialize bundle.
Parameters: - import_name – Name of the module where the WebpackBundle class
is instantiated. It is used to determine the absolute path to the
folderwhere the assets are located. - folder – Relative path to the assets.
- kwargs – Keyword arguments directly passed to
pywebpack.bundle.WebpackBundle.
- import_name – Name of the module where the WebpackBundle class
is instantiated. It is used to determine the absolute path to the
Command Line Interface¶
flask webpack¶
Webpack commands.
flask webpack [OPTIONS] COMMAND1 [ARGS]... [COMMAND2 [ARGS]...]...
build¶
Run NPM build-script.
flask webpack build [OPTIONS] [ARGS]...
Arguments
-
ARGS¶ Optional argument(s)