betty.project.extension.webpack package

Subpackages

Submodules

Module contents

Integrate Betty with Webpack.

This module is internal.

class betty.project.extension.webpack.PrebuiltAssetsRequirement[source]

Bases: Requirement

Check if prebuilt assets are available.

async is_met() bool[source]

Check if the requirement is met.

async summary() Localizable[source]

Get the requirement’s human-readable summary.

final class betty.project.extension.webpack.Webpack[source]

Bases: ShorthandPluginBase, Extension, CssProvider, Jinja2Provider

Integrate Betty with Webpack.

This is internal. It MAY be used anywhere in Betty’s source code, but MUST NOT be used by third-party code.

classmethod assets_directory_path() Path[source]

Return the path on disk where the extension’s assets are located.

This may be anywhere in your Python package.

build_requirement() Requirement[source]

Get the requirement that must be satisfied for Webpack builds to be available.

classmethod enable_requirement() Requirement[source]

Define the requirement for this extension to be enabled.

This defaults to the extension’s dependencies.

property filters: Mapping[str, Callable[[...], Any]]

Jinja2 filters provided by this extension.

Keys are filter names, and values are the filters themselves.

new_context_vars() Mapping[str, Any][source]

Create new variables for a new jinja2.runtime.Context.

Keys are the variable names, and values are variable values.

async prebuild(job_context: Context) None[source]

Prebuild the Webpack assets.

property public_css_paths: Sequence[str]

The public URL paths to the CSS files to include in each HTML page.

register_event_handlers(registry: EventHandlerRegistry) None[source]

Register event handlers with the project.

class betty.project.extension.webpack.WebpackEntryPointProvider[source]

Bases: ABC

An extension that provides Webpack entry points.

abstract webpack_entry_point_cache_keys() Sequence[str][source]

Get the keys that make a Webpack build for this provider unique.

Providers that can be cached regardless may return ().

abstract classmethod webpack_entry_point_directory_path() Path[source]

Get the path to the directory with the entry point assets.

The directory must include at least a package.json and main.ts.