Giter VIP home page Giter VIP logo

postcss-discard-duplicates's Introduction

postcss-discard-duplicates Build Status NPM version Dependency Status

Discard duplicate rules in your CSS files with PostCSS.

Install

With npm do:

npm install postcss-discard-duplicates --save

Example

This module will remove all duplicate rules from your stylesheets. It works on at rules, normal rules and declarations. Note that this module does not have any responsibility for normalising declarations, selectors or whitespace, so that it considers these two rules to be different:

h1, h2 {
    color: blue;
}

h2, h1 {
    color: blue;
}

It has to assume that your rules have already been transformed by another processor, otherwise it would be responsible for too many things.

Input

h1 {
    margin: 0 auto;
    margin: 0 auto
}

h1 {
    margin: 0 auto
}

Output

h1 {
    margin: 0 auto
}

Options

retainFirstOccurrence

Type: Boolean
Default: false

When true, only the first occurrence of any duplicates found will be retained.

When false, the last occurrence of any duplicates found will be retained (this is the default behavior).

Example

When retainFirstOccurrence = true.

Input

h1 {
    margin: 0 auto;
}
h2 {
    color: #333;
}
h1 {
    margin: 0 auto;
}

Output

h1 {
    margin: 0 auto;
}
h2 {
    color: #333;
}

Usage

See the PostCSS documentation for examples for your environment.

Contributors

Thanks goes to these wonderful people (emoji key):


Ben Briggs

๐Ÿ’ป ๐Ÿ“– ๐Ÿ‘€ โš ๏ธ

Bogdan Chadkin

๐Ÿ’ป ๐Ÿ‘€ โš ๏ธ

Lee Houghton

๐Ÿ’ป

Andy Jansson

๐Ÿ’ป โš ๏ธ

This project follows the all-contributors specification. Contributions of any kind welcome!

License

MIT ยฉ Ben Briggs

postcss-discard-duplicates's People

Contributors

ben-eb avatar greenkeeperio-bot avatar trysound avatar amatiasq avatar andyjansson avatar bsara avatar lee-houghton avatar

Watchers

James Cloos avatar  avatar  avatar

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.