postcss-selector-namespace icon indicating copy to clipboard operation
postcss-selector-namespace copied to clipboard

Migrated to postcss 8; add ability to use multiple namespaces

Open pryley opened this issue 4 years ago • 2 comments

I realise that this pull request may not be the easiest to review as the code has been migrated to the postcss 8 api.

See: https://evilmartians.com/chronicles/postcss-8-plugin-migration

Also solves: #8

pryley avatar Jan 22 '21 05:01 pryley

Thank you so much, this is great!

Could you add some tests for the "multiple namespaces" case, I'm not 100% sure I understand the use-case here without examples :)

topaxi avatar Jan 22 '21 13:01 topaxi

Could you add some tests for the "multiple namespaces" case, I'm not 100% sure I understand the use-case here without examples :)

Sure.

An example of multiple namespace usage is here:

https://github.com/pryley/site-reviews/blob/41584cd25b7cd5d586ab953d55ef3116eba39950/webpack.mix.js#L76

In that particular example, I am providing multiple namespaces for a plugin style that integrates with Divi, as the selectors are different depending on whether a Divi theme is used, or only the Divi Builder.

For example, with this configuration:

require('postcss-selector-namespace')({namespace: '#et-main-area, #et-boc'})

This:

.component {
    /* ... */
}

Becomes this:

#et-main-area .component,
#et-boc .component {
    /* ... */
}

pryley avatar Jan 22 '21 16:01 pryley