Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

svg-path-to-css-polygon

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svg-path-to-css-polygon

An overengineered library built just for Søren Birkemeyer 💌

  • 0.2.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

svg-path-to-css-polygon

An overengineered library built just for Søren Birkemeyer 💌

It's not a PostCSS plugin like I mentioned, just a function. But hopefully it helps. The source is pretty minimal. Should be possible to import into a PostCSS/Sass/something plugin.

Usage

yarn add svg-path-to-css-polygon
import svgPathToCssPolygon from 'svg-path-to-css-polygon'

svgPathToCssPolygon(
  // Pass your SVG's viewbox
  { x: 0, y: 0, width: 100, height: 100 },
  // Then pass the path's `d` attribute
  'M 0 0 L 50 50 L 0 50 Z'
)

// => 'polygon(0% 0%, 50% 50%, 0% 50%)'

Features:

  • Supports arbitrary SVG viewboxes
  • Supports absolute and relative commands

Non-features:

  • Does not support curves

Notes:

  • The "Z" closepath command is ignored, as CSS polygons are always closed.
  • Repeated "M" moveto commands are treated identically to "L" lineto commands.

FAQs

Package last updated on 11 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc