A (revamped) Sass function that will output properly encoded entities.
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
scss
test
.gitignore
README.md
package.json
sache.json

README.md

Entity

A (revamped) Sass function that will output properly encoded entities.

Why 🤔

No clue. I came across https://dev.w3.org/html5/html-author/charref and thought it would be fun. I ran a Node script that output the file then wrote some tests.

Usage

The entity function accepts the actual character, the HTML name without the ampersand and semi-colon or the decimal number.

body {
  &:after {
    content: entity('');
  }
}

or

body {
  &:after {
    content: entity('euro');
  }
}

will output

body:after {
  content: "\20AC";
}