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

oldie

v1.3.0

Published

Transform CSS into something compatible with older Internet Explorer

Downloads

4,343

Readme

Oldie Build Status

Oldie tranforms CSS to be compatible with old Internet Explorer.

<!--[if gt IE 8]><!--><link href="style.css" rel="stylesheet"><!--<![endif]-->
<!--[if lte IE 8]><link href="style.oldie.css" rel="stylesheet"><![endif]-->

If you’re like me, you stopped supporting IE8 years ago. Yet, here you are, satisfying another client that somehow managed to get this requirement past you.

Flatten Media Queries

Resolve media queries for a desktop experience.

/* before */

body {
    font-size: 12px;
}

@media screen and (max-width: 767px) {
    body {
        font-size: 16px;
    }
}

@media screen and (min-width: 768px) {
    body {
        color: #444;
    }
}

/* after */

body {
    font-size: 12px;
}

body {
    color: #444;
}

Replace :root

Swap :root selectors with html selectors.

/* before */

:root {
    background-color: black;
    color: white;
}

/* after */

html {
    background-color: black;
    color: white;
}

Reduce calc()

Reduce calc() references whenever possible.

/* before */

.banner {
    font-size: calc(16px * 3);
}

/* after */

.banner {
    font-size: 48px;
}

Resolve rem

Resolve rem values as standard pixels.

/* before */

.container {
    margin-top: 2.5rem;
}

/* after */

.container {
   margin-top: 40px;
}

Uphold opacity

Swap opacity properties with IE8 compatible filter properties.

/* before */

.figure {
    opacity: .5;
}

/* after */

.figure {
    filter: alpha(opacity=50);
}

Patch pseudo-elements

Swap :: selectors with IE8 compatible : selectors.

/* before */

a::after {
    content: " (" attr(href) ")";
}

/* after */

a:after {
    content: " (" attr(href) ")";
}

Retain rgba colors

Swap rgba values with IE8 compatible hex values and filter properties.

/* before */

.hero {
    background-color: rgba(153, 221, 153, .8);
    border: solid 1px rgba(100, 102, 103, .3);
}

/* after */

.hero {
    filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#8099dd99',endColorstr='#8099dd99');
    border: solid 1px #646667;
}

Forget :not

Remove :not() selectors while preserving the other selectors in a rule.

/* before */

.a, .b:not(.c), d {
    color: red;
}

/* after */

.a, .d {
    color: red;
}

Salvage :nth-child

Swap :nth-child selectors with :first-child.

/* before */

.container > p:nth-child(4).specific > span {
   font-weight: bold;
}
 
/* after */
 
.container > :first-child + * + * + p.specific > span {
    font-weight: bold;
}

Plugins

Oldie is powered by the following plugins:

Some of these plugins have more features than are described here. Visit their project pages to learn more about them individually.

Usage

Follow these steps to use Oldie.

Add Oldie to your build tool:

npm install oldie --save-dev

Node

require('oldie')({ /* options */ }).process(YOUR_CSS);

PostCSS

Add PostCSS to your build tool:

npm install postcss --save-dev

Load Oldie as a PostCSS plugin:

postcss([
    require('oldie')({ /* options */ })
]);

Gulp

Add Gulp PostCSS to your build tool:

npm install gulp-postcss --save-dev

Enable Oldie within your Gulpfile:

var postcss = require('gulp-postcss');

gulp.task('css', function () {
    return gulp.src('./css/src/*.css').pipe(
        postcss([
            require('oldie')({ /* options */ })
        ])
    ).pipe(
        gulp.dest('./css')
    );
});

Grunt

Add Grunt PostCSS to your build tool:

npm install grunt-postcss --save-dev

Enable Oldie within your Gruntfile:

grunt.loadNpmTasks('grunt-postcss');

grunt.initConfig({
    postcss: {
        options: {
            processors: [
                require('oldie')({ /* options */ })
            ]
        },
        dist: {
            src: 'css/*.css'
        }
    }
});

Options

Each plugin’s options may be configured by targeting the plugin’s namespace. Any plugins may be disabled by giving them a disable property.

Example:

require('oldie')({
    rgba: {
        filter: true
    },
    rem: {
        replace: false
    },
    unmq: {
        disable: true
    }
})