Giter VIP home page Giter VIP logo

postcss-plumber's People

Contributors

jamonserrano avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

teddybradford

postcss-plumber's Issues

Proposed syntax

To remain closest to both regular CSS and the original SASS version and also to adhere to the postcss plugin guidelines I propose the following syntax:

CSS input with a custom at-rule:

p {
    @plumber {
        grid-height: 1rem;
        baseline: 0.158203;
        font-size: 1.75;
        line-height: 3;
        leading-top: 1;
        leading-bottom: 2;
    }
}

CSS output with the whole at-rule replaced:

p {
    font-size: 1.75rem;
    line-height: 3rem;
    margin-top: 0;
    padding-top: 0.81641rem;
    padding-bottom: 0.18359rem;
    margin-bottom: 2rem;
}

Default parameters can be set in the plugin itself:

// Gulpfile
var processors = [
    plumber({
        gridHeight: '1rem',
        baseline: 0.158203,
        fontSize: 1.75,
        lineHeight: 3,
        leadingTop: 1,
        leadingBottom: 2
    })
];

Your comments are welcome!

Allow gridHeight regex to match a starting decimal

Some design system libraries provide units as .75rem rather than 0.75rem. I'd like to be able to use the value directly from a library. It would be great if Plumber supported this.

I haven't thoroughly tested this, but I think something like this would work:

const unitRegExp = /^((?:\d*\.)?\d+)([a-z]{1,4})$/;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.