Skip to content

How to configure filters using the YAML config option? Specifically cssrewrite. #540

@gg2

Description

@gg2

I'm using webassets, as part of a platform on Flask (CKAN) (so as built-in of Flask? I don't know).

I have a plugin that uses a js library, that uses some css themes, that are initially located relatively to each other:
js.js
js-themes/
default/
icons.png
style.css

style.css references url(icons.png).

Using webassets to bundle style.css, just adding cssrewrite as a filter without config fails with a ValueError in query_url_mapping: "'Cannot determine url for %s' % filepath".

I see in the docs, get_filter('cssrewrite', replace={'old_directory':'/custom/path/'})
replace looks like what I need.

I see there is the documentation for adding a config section to a YAML (if I interpret correctly):

config:
    another_custom_config_value: foo
bundles:
    # ...

So, what should cssrewrite config look like via YAML?
Variations on the following stabs-in-the-dark don't work or cause crashes parsing the YAML:

config:
  cssrewrite:
    - replace={'': 'assets/js-themes/default/'}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions