jinja2_webpack

class jinja2_webpack.Asset(filename, url)[source]

Asset class. Might someday expose file access here too so can render assets inline. For now the url is the interesting attribute

exception jinja2_webpack.AssetNotFoundException[source]

Thrown when an asset cannot be found, can be disabled by settings errorOnInvalidReference = False

class jinja2_webpack.Environment(**kwargs)[source]

The webpack environment class. Loads the manifest and allows it to be accessed. Settings: * manifest - default webpack-manifest.json. Path to the WebpackManifest file. * errorOnInvalidReference - default True. True if exception should be thrown when you try to resolve an invalid asset reference. * publicRoot - default /static/pack. The public path to prepend to all asset URLs.

identify_assetspec(spec)[source]

Lookup an asset from the webpack manifest. The asset spec is processed such that you might reference an entry with or without the extension.

Will raise an AssetNotFoundException if the errorOnInvalidReference setting is enabled and the asset cannot be found.

Note that all files must be have globally unique names, due to a limitation in the way that WebpackManifestPlugin writes the data.

register_renderer(extension, renderer)[source]

Register a new renderer function to the environment

render_asset(asset)[source]

Render an asset to a URL or something more interesting, by looking up the extension in the registered renderers