Comment 5 for bug 1771559

Revision history for this message
Walter (wdoekes) wrote : Re: error while loading icon with pyscss 1.3.5

$ pip freeze | grep pyScss
pyScss==1.3.4

$ python -m scss --style compact xstatic/pkg/mdi/data/scss/materialdesignicons.scss 2>&1 | uniq -c | head -n 10
   1650 ERROR: Function not found: function-exists:1
      1 @font-face { font-family: 'Material Design Icons'; src: url('../fonts/materialdesignicons-webfont.eot?v=1.6.50'); src: url('../fonts/materialdesignicons-webfont.eot?#iefix&v=1.6.50') format('embedded-opentype'), url('../fonts/materialdesignicons-webfont.woff2?v=1.6.50') format('woff2'), url('../fonts/materialdesignicons-webfont.woff?v=1.6.50') format('woff'), url('../fonts/materialdesignicons-webfont.ttf?v=1.6.50') format('truetype'), url('../fonts/materialdesignicons-webfont.svg?v=1.6.50#materialdesigniconsregular') format('svg'); font-weight: normal; font-style: normal; }
      1 .mdi { display: inline-block; font: normal normal normal 24px / 1 'Material Design Icons'; font-size: inherit; text-rendering: auto; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; transform: translate(0, 0); }
      1 .mdi-access-point:before { content: "\F002"; }
      1
      1 .mdi-access-point-network:before { content: "\F003"; }
      1
      1 .mdi-account:before { content: "\F004"; }
      1
      1 .mdi-account-alert:before { content: "\F005"; }

$ pip freeze | grep pyScss
pyScss==1.3.5

$ python -m scss --style compact xstatic/pkg/mdi/data/scss/materialdesignicons.scss 2>&1 | uniq -c | head -n 10
      1 @font-face { font-family: 'Material Design Icons'; src: url('../fonts/materialdesignicons-webfont.eot?v=1.6.50'); src: url('../fonts/materialdesignicons-webfont.eot?#iefix&v=1.6.50') format('embedded-opentype'), url('../fonts/materialdesignicons-webfont.woff2?v=1.6.50') format('woff2'), url('../fonts/materialdesignicons-webfont.woff?v=1.6.50') format('woff'), url('../fonts/materialdesignicons-webfont.ttf?v=1.6.50') format('truetype'), url('../fonts/materialdesignicons-webfont.svg?v=1.6.50#materialdesigniconsregular') format('svg'); font-weight: normal; font-style: normal; }
      1
      1 .mdi { display: inline-block; font: normal normal normal 24px / 1 'Material Design Icons'; font-size: inherit; text-rendering: auto; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; transform: translate(0, 0); }
      1
      1 .mdi-access-point:before { content: "xF002"; }
      1
      1 .mdi-access-point-network:before { content: "xF003"; }
      1
      1 .mdi-account:before { content: "xF004"; }
      1

So yes. \F004 is right, and xF004 is wrong. But those 1650 errors are wrong too.

It looks strange to me that pyScss takes the path of the existing function when it doesn't exist. (1.3.4 said 'function-exist' doesn't exists, and then took that path, see patch below).

This may also have been a fix that would work for 1.3.4 and 1.3.5:

$ diff -pu xstatic/pkg/mdi/data/scss/_functions.scss{.orig,}
--- xstatic/pkg/mdi/data/scss/_functions.scss.orig 2019-10-29 16:27:09.640420707 +0100
+++ xstatic/pkg/mdi/data/scss/_functions.scss 2019-10-29 16:27:24.256440797 +0100
@@ -1,14 +1,5 @@
 @function char($character-code) {
- @if function-exists("selector-append") {
- @return unquote("\"\\#{$character-code}\"");
- }
-
- @if "\\#{'x'}" == "\\x" {
- @return str-slice("\x", 1, 1) + $character-code;
- }
- @else {
- @return #{"\"\\"}#{$character-code + "\""};
- }
+ @return unquote("\"\\#{$character-code}\"");
 }

 @function mdi($name) {

I cannot speak for the validity of the scss/sass syntax and whether or not the undefined function should've been run. Not my cup of tea.

Walter Doekes
OSSO B.V.