GithubHelp home page GithubHelp logo

jaicab / sass-ext Goto Github PK

View Code? Open in Web Editor NEW
13.0 13.0 0.0 352 KB

The ext(); mixin sets a selector budget and controls duplicates on Sass' extend directive.

Home Page: http://jaicab.com/sass-ext/

CSS 100.00%

sass-ext's People

Contributors

jaicab avatar kittygiraudel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sass-ext's Issues

Add a `strict` option

An interesting feature would be to add a strict option to throw rather than warn when a budget has been overrun.

It could go like:

@mixin ext(
  $placeholder,
  $key: 'total',
  $flag: ''
) {
  // ...

  @if length($ext-map-key) > 0 and length(map-get($ext-map-key, $placeholder)) > map-get($ext-budget, $key) {
    @if ext-get-option('strict') {
      @error $message;
    } @else if ext-get-option('warn-over') {
      @warn $message;
    }
  }
}

Useless condition

@if variable-exists('ext-options') {
  $ext-opt: map-merge($ext-opt, $ext-options) !global;
}

Since you define $ext-options on top of the file and there is no way in Sass to unset a variable, this condition will always be met.

A more appropriate check would be:

@if type-of($ext-options) == 'map' {
  $ext-opt: map-merge($ext-opt, $ext-options) !global;
}

If you agree, I can submit a PR.

Use `@error` rather than `@warn`

Instead of @warning when something goes wrong regarding the Sass logic, I'd advise to throw an error with @error. There is no reason to let the script run when there is an error, so you better throw an actual error.

For instance:

@function ext-get-option($option) {
  @if not map-has-key($ext-opt, $option) {
    @error 'The option `#{$option}` is not defined or part of the options.';
  }

  @return map-get($ext-opt, $option);
}

API Documentation

What do you use as API documentation? I noticed SassDoc like comments, but they are not quite compatible though.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.