navanshu / postcss-variable-compress

Minifies / Obscures CSS variable names. Inspired by webpack's obscure plugin, though I never read its codebase
https://www.npmjs.com/package/postcss-variable-compress
MIT License
35 stars 1 forks source link

fix typescript types #38

Closed Kaciras closed 1 year ago

navanshu commented 1 year ago

@Kaciras can you explain why are you suggesting these changes of types?

Kaciras commented 1 year ago

index.d.ts does not export the plugin function.

Snipaste_2022-11-09_13-00-11

navanshu commented 1 year ago

@Kaciras I never noticed it, thanks for letting me know about this. As some changes were breaking the type system and I don't want to do it, I push a change, please verify if it works for you.

Kaciras commented 1 year ago

@navanshu TypeScript still shows the error:

Snipaste_2022-11-09_22-01-51

And if I change it to named import:

import { variableCompress } from "postcss-variable-compress";

variableCompress();

The code fails at runtime with the error: TypeError: variableCompress is not a function.

navanshu commented 1 year ago

@Kaciras Can you share some more code, on how you are using it.

navanshu commented 1 year ago

@Kaciras Puslished a new edit, I think this will solve the issue.

Kaciras commented 1 year ago

@navanshu It works, thanks.