betty.project.extension.webpack package - Betty documentation

Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar

# betty.project.extension.webpack package

## Subpackages

- betty.project.extension.webpack.jinja2 package
  - Submodules
    - betty.project.extension.webpack.jinja2.filter module
      - `filter_webpack_entry_point_js()`
  - Module contents

## Submodules

- betty.project.extension.webpack.build module
  - `Builder`
    - `Builder.__init__()`
    - `Builder.build()`
  - `EntryPointProvider`
    - `EntryPointProvider.webpack_entry_point_cache_keys()`
    - `EntryPointProvider.webpack_entry_point_directory_path()`
  - `webpack_build_id()`

## Module contents

Integrate Betty with Webpack.

This module is internal.

class betty.project.extension.webpack.PrebuiltAssetsRequirement

  Bases: `Requirement`

  Check if prebuilt assets are available.

  is_met() → bool

    Check if the requirement is met.

  summary() → Localizable

    Get the requirement’s human-readable summary.

final class betty.project.extension.webpack.Webpack

  Bases: `ShorthandPluginBase`, `Extension`, `CssProvider`, `Jinja2Provider`

  Integrate Betty with Webpack.

  __init__(project: Project, public_css_paths: Sequence[str])

    This is private. It MUST NOT be used anywhere outside its containing scope.

  classmethod assets_directory_path() → Path

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

    This may be anywhere in your Python package.

  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]

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

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

  async classmethod new_for_project(project: Project) → Self

    Create a new instance using the given project.

  async prebuild(job_context: Context) → None

    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

    Register event handlers with the project.

  async classmethod requirement() → Requirement

    Define the requirement for this extension to be enabled.

    This defaults to the extension’s dependencies.