Skip to content

AddClass doesn't handle case of class already starting with "body" #2

@dmnsgn

Description

@dmnsgn

Source code only handles html:

avif-in-css/index.js

Lines 14 to 16 in 13b0238

return selector.includes('html')
? selector.replace(/html[^ ]*/, `$& body${className}`)
: `body${className} ` + selector

The following:

body main {
  background-image: url(./assets/test.jpeg);
  background-size: contain;
}

will generate:

body.avif body main {
  background-image: url(/assets/test.0e61a19d72e86eea12e0.avif);
}

Same as in ai/webp-in-css#30

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