npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

knife-sass

v0.3.5

Published

Nail vertical rhythm, modular scale, and REMs like a boss with this simple set of SASS/SCSS variables, functions and mixins.

Downloads

39

Readme

knife

Nail vertical rhythm, modular scale, and REMs like a boss with this simple set of Sass/SCSS variables, functions and mixins.

Endorse on CoderWall

Note: This is an early release so expect things to change. I will do my best not to break stuff, and will let you know if something will break in the future..

Features

  • Simple to master and use.
  • Responsive friendly.
  • Work / think in px - win in REMs
  • Optional IE Support
  • Designed to be compatible with Grid Lover
  • Solves sub pixel rounding errors in different browsers by rounding out your base numbers.

Install

Install Sass:

gem install sass

Install Knife with Yarn:

yarn add knife

... or with NPM:

npm install knife

... or with Bower:

bower install knife

Alternatively, you can simply import the knife.sass file into you primary Sass/SCSS stylesheet after downloading and and including it in your project.

@import 'knife';

Usage

Note that this tool is heavily inspired by the fantatstic web app Grid Lover and its absolutely one of the eaiest ways to sort out these initial variables.

Set your basic variables

// Basic Type Variabless
$body-font-size: 	16px;
$body-line-height: 	1.5;
$scale-factor: 		1.333;
$ie8compatability:  true;

Set Your base font size on the html ans body

html { @include khtml(); }
body { @include kbody(); }

This can be done in your base or normalization files, or later on before you define youe type. You should be defining your typography straight after your normalize / reset.

Set up your Typography

h1,h2,h3,h4,h5,h6 {text-transform: uppercase;}
h1 { @include ktype(5, 1, 1); }
h2 { @include ktype(4, 1, 1); }
h3 { @include ktype(3, 1, 1); }
h4 { @include ktype(2, 1, 1); }
h5 { @include ktype(1, 1, 0); }
h6 {
@include ktype(0, 1, 0);
	font-weight: normal;
	text-transform: capitalize;
}
p, ul, ol {@include ktype(0,0,1);}
small { @include ktype(-1,0,1); }

Use the krem() mixin to set any other value in rems, because no one really spends their life thinking in relative units of measure.

@include krem("height", 160px);

Output :

note the bloat added by the IE compatability, obviously setting that to false will result in halving the output. Have a look at the basic demo in the example folder for more information.

// Type Setup
html {
  font-size: 16px;
  line-height: 24px; }

body {
  font-size: 16px;
  line-height: 24px;
  font-size: 1rem;
  line-height: 1.5rem; }

// Typography
h1, h2, h3, h4, h5, h6 {
  text-transform: uppercase; }

h1 {
  font-size: 68px;
  font-size: 4.25rem;
  line-height: 72px;
  line-height: 4.5rem;
  margin-top: 48px;
  margin-top: 3rem;
  margin-bottom: 24px;
  margin-bottom: 1.5rem; }

h2 {
  font-size: 51px;
  font-size: 3.1875rem;
  line-height: 72px;
  line-height: 4.5rem;
  margin-top: 24px;
  margin-top: 1.5rem;
  margin-bottom: 24px;
  margin-bottom: 1.5rem; }

h3 {
  font-size: 38px;
  font-size: 2.375rem;
  line-height: 48px;
  line-height: 3rem;
  margin-top: 24px;
  margin-top: 1.5rem;
  margin-bottom: 24px;
  margin-bottom: 1.5rem; }

h4 {
  font-size: 29px;
  font-size: 1.8125rem;
  line-height: 48px;
  line-height: 3rem;
  margin-top: 24px;
  margin-top: 1.5rem;
  margin-bottom: 24px;
  margin-bottom: 1.5rem; }

h5 {
  font-size: 22px;
  font-size: 1.375rem;
  line-height: 24px;
  line-height: 1.5rem;
  margin-top: 24px;
  margin-top: 1.5rem;
  margin-bottom: 0px;
  margin-bottom: 0rem; }

h6 {
  font-size: 16px;
  font-size: 1rem;
  line-height: 24px;
  line-height: 1.5rem;
  margin-top: 24px;
  margin-top: 1.5rem;
  margin-bottom: 0px;
  margin-bottom: 0rem;
  text-transform: capitalize; }

p, ul, ol, dl {
  font-size: 16px;
  font-size: 1rem;
  line-height: 24px;
  line-height: 1.5rem;
  margin-top: 0px;
  margin-top: 0rem;
  margin-bottom: 24px;
  margin-bottom: 1.5rem; }

small {
  display: inline-block;
  font-size: 13px;
  font-size: 0.8125rem;
  line-height: 24px;
  line-height: 1.5rem;
  margin-top: 0px;
  margin-top: 0rem;
  margin-bottom: 0px;
  margin-bottom: 0rem; }

About

Typography is an essential art for web and application development, a lot of the internet is essentailly slightly interactive documents, and its therefore imperative that we achieve strong vertical layouts and create a clear visual heirachy to our content.

Knife is essentially a small collections of mixins leveraging good typographic principals to make setting up strong typographic layouts reasonably quick, easy and intuitive. Right now knife is not seeking to solve every problem or individual instance, but is there to help you get going quickly, and have a great typographic foundation in your SCSS.

Project Goals

  • Make vertical rhythm, modular scale and rem units easy to implement and use.
  • Maintain and develop a small inuitive API for typography in scss
  • Switchable support for old browsers.
  • Stimulate the conversation about good web typography between developers and designers.

Acknowledgements & Inspiration

heavily inspired by the awesome web app Grid Lover and sevenupcan's sass gridlover mixin. I've been further pushed to develop this little SASS tool to help "onboard" team members with typographic layout principals, using REM units, speeding up starting dev time on projects and make something without a steep learning curve. I hope you find it useful too.

About Web Typography

Tools for Better Type

TODO :

  • add shift property to ktype
  • ~~Implement tests~~
  • Start thinking about a much stronger API for v1.0
    • better naming convention for variables
    • More Flexibility
  • Consider SASS Maps for handling properties better or changing propoerties for different sections.
  • ~~Handle old global variable warning nonsense~~
  • finish type template mixin
    • a super quick single mixin for mocking up pages.
    • Should have sensible defaults
    • should accept a map of properties
  • ~~handle unitless values~~
  • handle multiple values for padding / margin etc
  • Finish Wiki
  • Create awesome examples
  • ~~Finish killer logo~~ created by the awesome designer Sol Witcher
  • Make sick as f@!% Landing Page
  • ~~Finish resolve mixin~~
  • ~~add reduce to kbody~~
  • ~~add reduce to khtnl~~
  • ~~Add sache~~
  • ~~Add bower support~~
  • ~~finish push, pull~~
  • ~~suffix and prefix~~
  • ~~start type template mixin~~
  • ~~add 'offset' to accommodate border etc.~~
  • ~~Add basic Example~~
  • ~~add basic github page~~

License

MIT Licensed , Paul van Zyl 2015

Contributors

Please Feel free to make pull requests or suggest features, this project is super new and still growing into itself, I generally create feat/something branches for specific features, but will create a seperate development branch for contributors to make pull requests against.