Skip to content

[postcss-extract] Extract class selectors only #1166

Answered by romainmenke
MrHBS asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @MrHBS,

That is something I've been wanting to add for some time.

Currently we only support the PostCSS API itself.
So only these constructs can be filtered and selected :

  • at rules
  • rules
  • declarations
  • comments

But specific values, selectors, media queries, ... can not be targeted.

I've been considering something like this :

/*
  - select all rules
  - use the selector parser
  - pass in the selector of each rule as an argument to the selector parser
  - select all classes
*/
rule::selector-parser(selector) class

But there are two use cases that need these kind of extra parsers and a new syntax :

  1. parse selectors and select part of each selector
  2. parse selectors and select rules, values…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@MrHBS
Comment options

@romainmenke
Comment options

@MrHBS
Comment options

Answer selected by MrHBS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants