Skip to content
This repository was archived by the owner on Jul 21, 2023. It is now read-only.
This repository was archived by the owner on Jul 21, 2023. It is now read-only.

css_rewrite should always honor url() paths to rewrite, not just fonts. #80

@haroldiedema

Description

@haroldiedema

Currently, the css_rewrite build step only honors font faces that reference font files. It also puts all font files in the same directory which may cause collisions if multiple versions of the same font are being used (you never know) in separate directories, e.g. v1, v2, v3, etc.

My proposal would be to simply search all url(*) variants and rewrite paths if it references a relative file, providing the following conditions are met:

  • The path does not contain a protocol;
  • The path does not start with a /;
  • The path is not an embedded image (base64).

These conditions can easily be matched using a simple regex pattern.

Once a match is found, calculate the target directory based on the output path and create directories if necessary. Then rewrite the target path in the CSS.

I think this is how other CSS-rewrite modules do it too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions