Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[generatedFromCss] classes manquantes #226

Closed
edugouvfr opened this issue Jan 22, 2024 · 4 comments
Closed

[generatedFromCss] classes manquantes #226

edugouvfr opened this issue Jan 22, 2024 · 4 comments

Comments

@edugouvfr
Copy link

edugouvfr commented Jan 22, 2024

Bonjour, je viens de voir que certaines classes CSS ne sont pas extraites par le parser, il s'agit des classes comportant le caractère '@' comme dans l'exemple ci-dessous :

.fr-tile--vertical\@md {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }
@garronej
Copy link
Collaborator

Thanks for reporting!
Do you want to try submiting a PR? I can provide guidance.

@edugouvfr edugouvfr changed the title [generatedFromCss] classes manqyantes [generatedFromCss] classes manquantes Jan 23, 2024
@enguerranws
Copy link
Collaborator

I can take a look if you need @garronej @edugouvfr, sounds interesting to check it.

@garronej
Copy link
Collaborator

garronej commented Mar 6, 2024

@enguerranws yes please !

@enguerranws
Copy link
Collaborator

Hi @garronej,

I made some investigation on this.

  1. first issue, we're filtering CSS classes to only match the ones that starts by .fr- here, the regex doesn't capture characters like \@. This is easily fixable
  2. it seems that the DSFR team uses @ as part of their naming convention. From what I understand, backslash is only there to tell CSS not to parse @ as it should (media queries, etc.), and only use it as a common character. So, in the CSS, we have .fr-tile--vertical\@md but, in the DOM (and in fr.cx) we should use fr-tile--vertical@md.

I'm preparing a PR, updating the test and the code.

garronej added a commit that referenced this issue Mar 7, 2024
#226 edited regex to handle CSS selectors containing @ char
@garronej garronej closed this as completed Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants