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

Support each() function (Less.js 3.7.0) #85

Open
knospe- opened this issue Nov 23, 2022 · 4 comments
Open

Support each() function (Less.js 3.7.0) #85

knospe- opened this issue Nov 23, 2022 · 4 comments
Labels

Comments

@knospe-
Copy link

knospe- commented Nov 23, 2022

I am having a lot of trouble trying to upgrade FontAwesome to the latest version.

I’ve uploaded all the kit for FontAwesome 6 but running the compiler returns errors because of ParseError: Unexpected input in from the FontAwesome less files even though I believe they are syntatically correct (example below).

ParseError: Unexpected input in _sizing.less on line 15, column 5
13|
14| // step-based scale (with alignment)
15| each(.fa-sizes(), {
16|   .@{fa-css-prefix}-@{key} {
17|     .fa-size(@value);
18|   }
@knospe- knospe- changed the title FontAwesome + Magento 2 FontAwesome 6 Nov 23, 2022
@friendscottn
Copy link

Did you find a workaround? Same issue here.

@knospe-
Copy link
Author

knospe- commented Dec 16, 2022

No yet, unfortunately.

@somegooser
Copy link

I know it is not the way but cant you change the "each" function with oldschool way?

@iterations: 100;

// helper class, will never show up in resulting css
// will be called as long the index is above 0
.loopingClass (@index) when (@index > 0) {

    // create the actual css selector, example will result in
    // .myclass_30, .myclass_28, .... , .myclass_1
    (~".span@{index}") {
        // your resulting css
        width: percentage((@index - 1) *0.01);
    }

    // next iteration
    .loopingClass(@index - 1);
}

// "call" the loopingClass the first time with highest value
.loopingClass (@iterations);

@Krinkle Krinkle added Type: Enhancement New feature or request Type: Upstream labels Sep 9, 2023
@Krinkle Krinkle changed the title FontAwesome 6 Support Less.js 3.7.0 each() function (FontAwesome 6) Sep 9, 2023
@Krinkle
Copy link
Member

Krinkle commented Sep 9, 2023

Minimal test case:

// https://github.com/FortAwesome/Font-Awesome/blob/6.4.2/less/_variables.less
@fa-css-prefix          : fa;
@fa-size-scale-sm       : 14;
@fa-size-scale-lg       : 20;
@fa-size-scale-xl       : 24;
.fa-sizes() {
  sm                    : @fa-size-scale-sm;
  lg                    : @fa-size-scale-lg;
  xl                    : @fa-size-scale-xl;
}

// https://github.com/FortAwesome/Font-Awesome/blob/6.4.2/less/_mixins.less
.fa-size(@font-size) {
  line-height: (1 / @font-size) * 1em;
}

each(.fa-sizes(), {
  .@{fa-css-prefix}-@{key} {
    .fa-size(@value);
  }
});

http://ecomfe.github.io/est/fiddle/#version=3.6.0&autoprefix=false&est=false&autorun=false

On Less.js 3.6.0:

Syntax error: Function 'each' is undefined
Line 17: each(.fa-sizes(), {

On Less.js 3.7.0:

.fa-sm {
  line-height: 0.07142857em;
}
.fa-lg {
  line-height: 0.05em;
}
.fa-xl {
  line-height: 0.04166667em;
}

@Krinkle Krinkle changed the title Support Less.js 3.7.0 each() function (FontAwesome 6) Support each() function (Less.js 3.7.0) Sep 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

4 participants