Skip to content

PostCSS plugin which add SVG hack for clip-path property to make it work in Firefox

Notifications You must be signed in to change notification settings

komachi/postcss-clip-path-polyfill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

postcss-clip-path-polyfill

PostCSS plugin which add SVG hack for clip-path property to make it work in Firefox. Currently supports only polygon().

/* Input */
.test1 {
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}
/* Output */
.test1 {
  clip-path: url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg"%3E%3Cdefs%3E%3CclipPath id="p" clipPathUnits="objectBoundingBox"%3E%3Cpolygon points="0.5 0, 0 1, 1 1" /%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E#p');
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

It doesn't add vendor prefixes so you should use it with autoprefixer.

Installation

npm i postcss postcss-clip-path-polyfill --save-dev

Usage

Check out PostCSS documentation on how to use PostCSS plugins.

About

PostCSS plugin which add SVG hack for clip-path property to make it work in Firefox

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published