core.filters
Extra webasset filters.
Classes
DukPy is a simple javascript interpreter for Python built on top of |
|
Overrides the default datauri filter to work around this issue: |
|
Adds the rcssmin filter (not yet included in webassets) |
Module Contents
- class core.filters.JsxFilter(**kwargs)[source]
Bases:
dukpy.webassets.BabelJSX
DukPy is a simple javascript interpreter for Python built on top of duktape engine without any external dependency.
Note: let is not supported by the duktape engine, see https://github.com/amol-/dukpy/issues/47.
- input(_in: IO[str], out: IO[str], *, source_path: str | None = None, **kwargs: Any) None [source]
- Parameters:
kwargs – are actually babel options
- setup() None [source]
Overwrite this to have the filter do initial setup work, like determining whether required modules are available etc.
Since this will only be called when the user actually attempts to use the filter, you can raise an error here if dependencies are not matched.
Note: In most cases, it should be enough to simply define the
options
attribute. If you override this method and want to use options as well, don’t forget to call super().Note: This may be called multiple times if one filter instance is used with different asset environment instances.
- class core.filters.DataUriFilter(**kwargs)[source]
Bases:
webassets.filter.datauri.CSSDataUri
Overrides the default datauri filter to work around this issue:
- class core.filters.RCSSMinFilter(**kwargs)[source]
Bases:
webassets.filter.Filter
Adds the rcssmin filter (not yet included in webassets)
- setup() None [source]
Overwrite this to have the filter do initial setup work, like determining whether required modules are available etc.
Since this will only be called when the user actually attempts to use the filter, you can raise an error here if dependencies are not matched.
Note: In most cases, it should be enough to simply define the
options
attribute. If you override this method and want to use options as well, don’t forget to call super().Note: This may be called multiple times if one filter instance is used with different asset environment instances.