A small mixin and function helper library for Sass projects.
With NPM:
npm install @azinasili/bytes --saveInstall Bytes with Bower package manager:
bower install bytes --saveImport Bytes into your stylesheet:
@import "path/to/bytes/bytes";It’s not recommended to add or modify files so that you can update them easily.
Bytes uses Sassdoc for documentation. Docs can be generated via the command line using Grunt.
Install dependencies:
npm installGenerate and open docs in your browser:
gruntGenerate docs:
grunt docsFunctions
Mixins
emremfont-facecentercirclehide-textopacitytrianglelist-unstyledtruncateword-wraphidpiplaceholdersetwidthpaper-depthpaper-ripplez-indexbreakpoint-check
Here are all of Bytes global settings with their default value:
$bytes: (
'animate-easing' : cubic-bezier(.4, 0, .2, 1),
'animate-timing' : .4s,
'black' : rgb(0, 0, 0),
'font-size' : 16px,
'media-path' : '../assets',
'white' : rgb(255, 255, 255),
);You can set your own global defaults. Create a $bytes variable containing any key/value you need.
$bytes: (
'font-size' : 14px,
'media-path' : '../../img',
);$map: (
'foo': 'bar',
);
.test {
content: get($map, 'foo');
}.test {
line-height: strip-unit(2rem);
}.test {
padding: em(6px 12px);
}.test {
padding: rem(6px 12px);
}.test {
color: tint(#bada55, 15%);
}.test {
color: shade(#bada55, 15%);
}.test {
color: transparent(#bada55, 85%);
}.test {
color: chroma(#bada55, -10%);
}.test {
color: color(#bada55, 10%, -35%);
}.test {
color: dynamic-color(#bada55);
}$list: ('header', 'modal');
.test {
z-index: z-index($list, 'modal');
}
.test {
z-index: z($list, 'modal');
}.test {
background: path('kitten.jpg') no-repeat 0 0;
}.test {
transition: animate(all, .5s);
}.test {
@include em(padding, 10px);
}.test {
@include rem(padding, 10px);
}.test {
@include font-family('Open Sans', '../fonts');
}.test {
@include center('both', 'absolute');
}.test {
@include circle(20px, 10px);
}.test {
@include hide-text();
}.test {
@include opacity(30%);
}.test {
@include triangle(20px, 10px, #bada55, 'bottom');
}.test {
@include list-unstyled();
}.test {
@include truncate();
}.test {
@include word-wrap();
}.test {
@include hidpi() {
// CSS styles
};
}.test {
@include placeholder() {
// CSS styles
};
}$map: (
'background': black;
'hover': (
'color': white
)
);
.test {
@include set($map);
&:hover {
@include set($map, 'hover');
}
}.test {
@include width(200px, 500px);
}.test {
@include paper-depth(3);
}.test {
@include paper-ripple(black white);
}$list: ('header', 'modal');
.test {
@include z-index($list, 'modal');
}$map: (
'mobile': 320px,
'tablet': 740px,
'laptop': 980px,
);
@include breakpoint-check($map);- Add testing suite