sass/dart-sass

Add ASCII output support

Ouverte

#568 ouverte le 11 janv. 2019

 (53 commentaires) (17 réactions) (0 personne assignée)Dart (376 forks)batch import
enhancementhelp wanted

Métriques du dépôt

Stars
 (4 192 étoiles)
Métriques de merge PR
 (Merge moyen 8j 8h) (18 PRs mergées en 30 j)

Description

I've been working on a product using libsass/sassc and have migrated it to Dart Sass. Presently, this product doesn't support UTF-8 characters in stylesheets.

It looks like Dart Sass only supports outputting as UTF-8, with dart-lang/sdk#11744 being the blocker given in the README for why there's no support for more encodings (UTF-16, etc). Dart does however appear to have an AsciiEncoder.

For the time being, we've added an extra step to CSS escape non-ASCII characters in generated stylesheets. (On a related note, we also remove the @charset 'UTF-8'; atrule, both because it would be technically incorrect for an ASCII-encoded stylesheet, and because of #567.)

This isn't trivial because of sourcemaps, so we're doing this step with a PostCSS plugin.

Would adding ASCII-encoded output support be in scope of Dart Sass? I'd imagine when Dart adds other encoders, having this ready would let other encodings be sibling output options alongside UTF-8 and ASCII.

Guide contributeur