H
H
HelpSophie2021-05-24 03:55:49
Sass
HelpSophie, 2021-05-24 03:55:49

How to set ignore for SCSS font mixin in stylelint?

There is a SCSS mixin for generating fonts

spoiler

@mixin font-face($name, $path, $weight: null, $style: null, $exts: eot woff2 woff ttf svg) {
  $src: null;

  $extmods: (
    eot: "?",
    svg: "#" + str-replace($name, " ", "_")
  );

  $formats: (
    otf: "opentype",
    ttf: "truetype"
  );

  @each $ext in $exts {
    $extmod: if(map-has-key($extmods, $ext), $ext + map-get($extmods, $ext), $ext);
    $format: if(map-has-key($formats, $ext), map-get($formats, $ext), $ext);
    $src: append($src, url(quote($path + "." + $extmod)) format(quote($format)), comma); /* stylelint-disable-line function-url-quotes */
  }

  @font-face {
    font-family: quote($name);
    src: $src;
    font-weight: $weight;
    font-style: $style;
    // font-display: block;
    font-display: swap;
  }
}

@include font-face("Montserrat", "/app/fonts/Montserrat/Montserrat-Regular", normal, normal, woff2 woff);
@include font-face("Montserrat", "/app/fonts/Montserrat/Montserrat-Bold", bold, normal, woff2 woff);



In particular, it contains the line
$src: append($src, url(quote($path + "." + $extmod)) format(quote($format)), comma);


stylelint swears at function-url-quotes

What should be added to the linter settings so that it ignores the string url(quote?

Tried
"function-url-quotes": ["always", {
      "ignorePattern": "url(quote"
    }],

but says that function-url-quotes do not have ignorePattern

ps I know how to write ignore in the mixin itself. But this option is not to my liking.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question