scss utility collection
npm install thejungle
@use 'thejungle' as tj;
@debug tj.strip-unit(3em); // => 3
@debug tj.strip-unit(4pt); // => 4
@debug tj.em(12px); // => 0.75em
@debug tj.em(12px, 12px); // => 1em
@use 'thejungle' as tj with (
$default-base-size: 12px
)
@debug tj.em(12px); // => 1em
@debug tj.rem(12px); // => 0.75.rem
@debug tj.rem(12px, 12px); // => 1rem
@use 'thejungle' as tj with (
$default-base-size: 12px
)
@debug tj.rem(12px); // => 1em
Returns a formula that satisfies values ββat each screen.
@debug tj.between(10px, 100px, 400px, 1000px); // => calc(15vw - 50px);
@use 'thejungle' as tj with (
$default-from-screen: 400px,
$default-to-screen: 1800px
)
@debug tj.between(10px, 100px); // => tj.between(10px, 100px, 400px, 1800px);
@function fn1($args...) {
@debug tj.pos-shorthand($args);
}
@function fn2($args...) {
@debug tj.pos-shorthand($args, (top: 10px, left: 10px));
}
// unnamed arguments
fn1(1px); // => Map(top: 1px; right: 1px; bottom: 1px; left:1px)
fn1(1px, 2px); // => Map(top: 1px; right: 2px; bottom: 1px; left:2px)
fn1(1px, 2px, 3px); // => Map(top: 1px; right: 2px; bottom: 3px; left:2px)
fn1(1px, 2px, 3px, 4px); // => Map(top: 1px; right: 2px; bottom: 3px; left:4px)
// named arguments
fn1($top: 5px); // => Map(top: 5px;)
fn2($top: 5px); // => Map(top: 5px; left:10px)
// empty arguments
fn1(); // => Map()
fn2(); // => Map(top: 10px, left: 10px;)
@use 'thejungle' as tj with (
$default-pos-shorthand: (top: 30px; left: 100px)
)
@include tj.size(50px); // => width: 50px; height: 50px;
@include tj.size(50px, 100px); // => width: 50px; height: 100px;
@include tj.text-hide();
overflow: hidden;
text-indent: -9999px;
@include tj.ellipsis(100px);
max-width: 100px;
display: inline-block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
.a {
@include tj.clearfix;
}
.a::after {
content: '';
display: block;
clear: both;
}
@include tj.stretch;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
@include tj.stretch(10px);
// => top: 10px; right: 10px; bottom: 10px; left: 10px;
@include tj.stretch(10px, 50px);
// => top: 10px; right: 50px; bottom: 10px; left: 50px;
@include tj.stretch(10px, 50px, 100px);
// => top: 10px; right: 50px; bottom: 100px; left: 50px;
@include tj.stretch(10px, 50px, 100px, 200px);
// => top: 10px; right: 50px; bottom: 100px; left: 200px;
- top
- right
- bottom
- left
- top-left
- top-right
- bottom-left
- bottom-right
@include tj.triangle(top, #000, 30px);
border-style: solid;
height: 0;
width: 0;
border-color: transparent transparent #000 transparent;
border-width: 0 15px 15px 15px;
.column {
@include tj.column(4, 10px);
}
.column {
width: calc(25% - 7.5px);
}
.column:not(:nth-child(4n)) {
margin-right: 10px;
}
.a {
@include tj.animate(1s infinite) {
from{ width: 0 }
to{ width: 100% }
}
}
.a {
animation: __ANIMATE__u0bd4b920 1s infinite; /* π "__ANIMATE__u0bd4b920" is unique. */
}
@keyframes __ANIMATE__u0bd4b920 {
from{ width: 0 }
to{ width: 100% }
}
Override the default values for mixin contents.
@debug tj.em(16px); // => 1em
@include tj.scoped-default($base-size: 32px) {
@debug tj.em(16px); // => 0.5em
@include tj.scoped-default($base-size: 8px) {
@debug tj.em(16px); // => 2em
}
@debug tj.em(16px); // => 0.5em
}
MIT