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

postcss-proportional

v1.0.0

Published

PostCSS plugin to make layouts responsively proportional

Downloads

352

Readme

PostCSS Proportional

npm version npm downloads license build status

This is a PostCSS plugin to make layouts responsively proportional. It allows you to scale the values in px ​​of all properties in your code proportionally based on media queries.

Installation

npm

$ npm install postcss-proportional

yarn

$ yarn add postcss-proportional

Configuration

PostCSS is a tool for transforming CSS with JavaScript plugins. It allows you to write modern CSS syntax and apply various transformations to your stylesheets. By having PostCSS installed, you can easily integrate the postcss-proportional plugin into your build process and leverage its responsive proportional layout capabilities. Make sure to install PostCSS before configuring and using the plugin in your project.

To add the postcss-proportional plugin to your PostCSS configuration, you need to update your postcss.config.json file. Here's an example of how you can do it:

{
  "plugins": [
    "postcss-proportional"
  ]
}

If you don't have a postcss.config.json file in your project, you can create one in the root directory and add the above configuration to it.

Usage

In the example below, the proportional feature is applied to the html element. It sets the scale to 0.5 and the rounding to floor when the viewport width is less than or equal to 1400px. When used, the property proportional: skip; nullifies the effect of the plugin on the following line.

html {
  font-size: 20px;
  max-width: 1000px;
  proportional: skip;
  margin: 5px;
}

@media (max-width: 1400px) {
  proportional {
    scale: 0.5;
    rounding: floor;
  }
}

The following code is generated by PostCSS after processing the above stylesheet:

html {
  font-size: 20px;
  max-width: 1000px;
  margin: 5px;
}

@media (max-width: 1400px) {
  html {
    font-size: 10px;
    max-width: 500px;
  }
}

Other properties that can be added to the code are:

  • proportional: keep; - Keeps the scaled value even if it is the same as the initial one.
  • proportional: rounding-ceil; - Changes the rounding mode for the next property. Other values ​​can be rounding-none, rounding-floor and rounding-round.