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

Semantic UI produces bad output #364

Open
Deraen opened this issue Aug 5, 2017 · 1 comment
Open

Semantic UI produces bad output #364

Deraen opened this issue Aug 5, 2017 · 1 comment

Comments

@Deraen
Copy link

Deraen commented Aug 5, 2017

Related: #295

Semantic-UI calls a mixing, which produces url @import, inside & block. Less.js hoists this import to top-level. Less4j leaves the import inside block and prints a warning.

Example:

// src/themes/default/globals/site.variables
@importGoogleFonts: true;

// theme.less
.loadFonts() when (@importGoogleFonts) {
  @import url('https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic&subset=latin');
}

// semantic.less imports site.less inside & { ... }
// https://github.com/Semantic-Org/Semantic-UI/blob/f725b162e70896e38257965424ac7f9af486b927/src/semantic.less#L15

& {
  // src/definitions/site.less
  .loadFonts();
}

Test:

❯ lessc semantic.less
@import url('https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic&subset=latin');

~/Source/less4j master*
❯ java -jar less4j-1.17.2.jar semantic.less
 {
  @import url('https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic&subset=latin');
}
Warnings produced by compilation of semantic.less
WARNING 6:3 Compilation resulted in incorrect CSS. The IMPORT ended up inside a body of rule set located at 12:1.
 5: .loadFonts() when (@importGoogleFonts) {
 6:   @import url('https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic&subset=latin');
 7: }
@arichiardi
Copy link

Hello folks! I stumbled upon this one today, any update/workaround?

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

2 participants