Skip to content

PostCSS plugin that updates the standard object-fit tag to work with the object-fit-images polyfill for browsers that do not natively support object-fit.

License

Notifications You must be signed in to change notification settings

ronik-design/postcss-object-fit-images

Repository files navigation

PostCSS Object Fit Images Build Status

PostCSS plugin that updates the standard object-fit tag to work with the object-fit-images polyfill for browsers that do not natively support object-fit..

For use with object-fit-images

.foo {
    object-fit: cover;
    object-position: top;
}

Compiles to:

.foo {
    font-family: "object-fit: cover; object-position: top";
    object-fit: cover;
    object-position: top;
}

Existing font and font-family

Existing font and font-family declarations are kept and object-fit-images will still work:

.foo {
    object-fit: cover;
    object-position: top;
    font-family: "Helvetica Neue";
}

/* Compiles to: */

.foo {
    object-fit: cover;
    object-position: top;
    font-family: "object-fit:cover;object-position:top", "Helvetica Neue";
}
.foo {
    object-fit: cover;
    object-position: top;
    font: strong 1em/1.4 "Helvetica Neue";
}

/* Compiles to: */

.foo {
    object-fit: cover;
    object-position: top;
    font: strong 1em/1.4 "Helvetica Neue";
    font-family: "object-fit:cover;object-position:top", "Helvetica Neue";
}

Install

npm install postcss-object-fit-images --save-dev

Usage

postcss([ require('postcss-object-fit-images') ])

See PostCSS docs for examples for your environment.

Contributors

About

PostCSS plugin that updates the standard object-fit tag to work with the object-fit-images polyfill for browsers that do not natively support object-fit.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •