jaicab / sass-ext Goto Github PK
View Code? Open in Web Editor NEWThe ext(); mixin sets a selector budget and controls duplicates on Sass' extend directive.
Home Page: http://jaicab.com/sass-ext/
The ext(); mixin sets a selector budget and controls duplicates on Sass' extend directive.
Home Page: http://jaicab.com/sass-ext/
What do you use as API documentation? I noticed SassDoc like comments, but they are not quite compatible though.
Instead of @warn
ing 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);
}
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;
}
}
}
@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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.