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

@bgschiller/unitconversion

v2.2.13

Published

Simple SCSS functions for unitconversion

Downloads

261

Readme

_unitconversion.scss (v.2.2.13)

This is a fork of https://github.com/jakob-e/unitconversion. The only difference is that I've applied the sass division migration.

Convert Anything (almost)

At the moment the following units are supported (please comment if something is wrong/missing):

px, pt, pc, in, mm, cm, em, rem, ex, ch, vw, vh, vmin, vmax,
deg, rad, grad, turn, dpi, dpcm, dppx, s, ms, hz, khz, number,
ratio

NPM

npm install @bgschiller/unitconversion

Simple Syntax

Rather than going with the "good" old fromUnit-to-toUnit(fromUnit) syntax this function set is based on toUnit(fromUnit) making it a lot shorter and less cumbersome to maintain – as shown below :-)

       pt-to-px(input);
       pc-to-px(input);
       in-to-px(input);
       mm-to-px(input);    ==>   px(input);
       cm-to-px(input);
       em-to-px(input);
       rem-to-px(input);
       num-to-px(input);

Note!

  • To allow conversion between relative and absolute lengths em and rem are calculated as pixel values based on $root-font-size and $base-font-size (16px browser default). If you change the base font size of your document – remember to set the $root-font-size and $base-font-size variables accordingly.

  • To ease the job of handling compounds the em function takes multiple arguments. Each argument is treated as an em compound and used to calculate the visual size. Example – how to set a visual size of 18px on a class nested in an element with a font-size of 2em:

      .class {
          font-size: em(18px, 2em);  ==>   0.5625em;
      }
  • If you use unit conversion in relation to the font shorthand syntax be aware that line-height "/" will cause division. To prevent this from happening you can either either interpolate the value or use + to add the pieces together without calculation:
      h2 {
          font:300 #{em(24px)}/3 'Lato', sans-serif;
      }

Cive it a try on: Sassmeister.com

The MIT License (MIT) Copyright (c) 2016 Jakob Eriksen

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.