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

Separate character codes as SCSS variables #103

Open
milichev opened this issue Mar 22, 2018 · 0 comments
Open

Separate character codes as SCSS variables #103

milichev opened this issue Mar 22, 2018 · 0 comments
Labels

Comments

@milichev
Copy link

Sometimes we have to style elements as icons without additional elements in markup, for example styling input[type="checkbox"]:before. To do so it would be great to have a separate file simple-line-icon-variables.scss with only font-face mixin and charcode declarations like the following:

$simple-line-font-path: "../fonts/" !default;
$simple-line-font-family: "simple-line-icons" !default;
$simple-line-icon-prefix: "icon-" !default;

@mixin simple-line-font-icon {
  font-family: '#{$simple-line-font-family}';
  speak: none;
  font-style: normal;
  font-weight: normal;
  font-variant: normal;
  text-transform: none;
  line-height: 1;

  /* Better Font Rendering =========== */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

$simple-line-icon-user: "\e005";
...
$simple-line-icon-login: "\e066";
$simple-line-icon-logout: "\e065";

Then in simple-lines-icons.scss:

@import "simple-line-icon-variables";

.#{$simple-line-icon-prefix} {
  &user,
  ...
  &social-steam {
    @include simple-line-font-icon;
  }

.#{$simple-line-icon-prefix}user:before {
  content: $simple-line-icon-user;
}

And somewhere in our code something like that:

@import "~simple-line-icons/scss/simple-line-icon-variables";

input[type="checkbox"].fancy {
  display:none;

  & + label {
    &:after {
      @include simple-line-font-icon;
      content: $simple-line-icon-check;
    }
  }
}

The same goes for LESS.
I can make a pull request if it is interesting for anyone else.

@mruz mruz added the feature label May 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants