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

Unwanted characters are inserted when escaping CSS strings #121

Closed
nibushibu opened this issue Jul 17, 2019 · 4 comments
Closed

Unwanted characters are inserted when escaping CSS strings #121

nibushibu opened this issue Jul 17, 2019 · 4 comments
Assignees

Comments

@nibushibu
Copy link
Member

nibushibu commented Jul 17, 2019

I hope you can check my repository below.
https://github.com/nibushibu/Getup

After compilation, unnecessary characters are inserted into CSS (SCSS) described in the file / src/riot/my-app.riot.

Before

/* style tag (scss) in `my-app.riot` */

h1 {
  color: green;
  display: flex;
}

.unmount-animation {
  opacity: 1;
  transition: opacity 1s;

  &.is-unmount {
    opacity: 0;
  }
}

After (compiled)

my-app h1,[is="my-app"] h1{A   color: green;A   display: flex; } my-app AA.unmount-animation,[is="my-app"] AA.unmount-animation{A   opacity: 1;A   transition: opacity 1s; } my-app A   .unmount-animation.is-unmount,[is="my-app"] A   .unmount-animation.is-unmount{A     opacity: 0; }A

When I checked why the unwanted A character was inserted, I found that it was inserted aftercssEscape ()was executed.

const cssCode = (options.scopedCss ?
scopedCSS(escapedCssIdentifier, cssEscape(preprocessorOutput.code)) :
cssEscape(preprocessorOutput.code)
).trim()

cssEscape (preprocessorOutput.code)

By rewriting the above part (2 places) as below, we could avoid the problem for the time being.

preprocessorOutput.code

I think the above is temporary workaround, but I could not find a fundamental solution.

If this is a problem with my file, please point out the cause, or if it is a bug, please help me solve it. 🙇

@GianlucaGuarini
Copy link
Member

Ok that's a weird issue, it seems that the preprocessor adds chars to escape to the css code. I will check this issue during the weekend thank you for reporting it!

@GianlucaGuarini GianlucaGuarini self-assigned this Aug 1, 2019
@GianlucaGuarini
Copy link
Member

I am trying to reproduce the issue but I got no luck. Could you please post the css string failing?

GianlucaGuarini added a commit that referenced this issue Aug 2, 2019
GianlucaGuarini added a commit that referenced this issue Aug 2, 2019
GianlucaGuarini added a commit that referenced this issue Aug 3, 2019
GianlucaGuarini added a commit that referenced this issue Aug 3, 2019
* master:
  fixed: eslint warning
  4.3.6
  updated: changelog
  closes #122
  closes #122
  added: test for #121
  added: other tests
  fix: Chained object access as text expression
  fixes riot/riot#2737
  4.3.5
  updated: fix css unicode properties
  4.3.4
  updated: changelog
  updated: attempt to fix riot/riot#2714
  4.3.3
  added: changelog
@GianlucaGuarini
Copy link
Member

Ok locally I was unable to produce the issue but the CI seems to have found it https://travis-ci.org/riot/compiler

@GianlucaGuarini
Copy link
Member

@nibushibu ok the issue appears only in node 10. Everything works fine in node 12. I am trying to find a solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants