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

trim getPatternConfiguration() #220

Open
iuscare opened this issue Nov 30, 2022 · 0 comments
Open

trim getPatternConfiguration() #220

iuscare opened this issue Nov 30, 2022 · 0 comments

Comments

@iuscare
Copy link
Contributor

iuscare commented Nov 30, 2022

Is your feature request related to a problem? Please describe.
When writing tailwind classes, we often end up writing multiple classes per breakpoints. To keep things readable I tend to separate breakpoints specific rules by lines within the yml of an pattern.

E.g.:

  variants:
    default:
      label: Default
      configuration:
        font_families: |
          prose-h1:font-serif prose-h2:font-serif prose-h3:font-serif prose-h4:font-sans prose-p:font-sans
          lg:prose-h3:font-serif lg:prose-h4:font-serif
        font_sizes: |
          prose-h1:text-2xl prose-h2:text-2xl prose-h3:text-xl prose-h4:text-lg
          lg:prose-h1:text-4xl lg:prose-h2:text-3xl lg:prose-h3:text-2xl lg:prose-h4:text-xl
          prose-p:text-base prose-p:text-lg
    article:
      label: Article
      configuration:
        font_families: |
          prose-h1:font-serif prose-h2:font-serif prose-h3:font-sans prose-h4:font-sans prose-p:font-sans
          lg:prose-h4:font-serif
        font_sizes: |
          prose-h1:text-2xl prose-h2:text-xl prose-h3:text-lg prose-h4:text-base
          lg:prose-h1:text-3xl lg:prose-h2:text-2xl lg:prose-h3:text-xl lg:prose-h4:text-lg
          prose-p:text-base lg:prose-p:text-lg

Doing so leads to undesired line breaks within the html markup when we render this specific component:
CleanShot 2022-11-30 at 16 10 10@2x

Describe the solution you'd like
It would be nice to modify the output to eliminate undesired line breaks within html markup. Maybe we just need to modify the getPatternConfiguration function with an regression rule replace(/[\r\n]/gm, '');

Describe alternatives you've considered
I also tried to use |trim on the pattern_configuration when rendering the component with twig. I also tried to use the |replace filter but it doesnt allow regex out of the box.

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

1 participant