svengau / tailwindcss-hero-patterns

A simple tailwind plugin to display Hero Patterns by @steveschoger.
95 stars 6 forks source link

Bugfix: Error when using Sveltekit/Typescript #4

Closed Derek-Devs closed 1 year ago

Derek-Devs commented 1 year ago

Hello,

When running a dev server with this plugin I encountered the following error:

[postcss] color.replace is not a function

VS Code/Typescript pointed me to the index.js of this plugin on line 38 Originally:

.replace("{{color}}", color.replace("#", "%23"))

Typescript didn't like this, so I updated the replace method call to 'color.toString().replace("#", "%23")' which first converts the object to a string before calling the replace method.

This resolved the issue, final replacement code for line 38 below:

.replace("{{color}}", color.toString().replace("#", "%23")).

As far as I can tell this should not cause any issues with other technologies using this plugin, and will make it play nice with Typescript.

svengau commented 1 year ago

PR https://github.com/svengau/tailwindcss-hero-patterns/pull/5 merged 🙏