CommonJS module #8
-
I want to create an PostCSS plugin that it's like a polyfill for new CSS functions that will help choosing the right contrast color and things like that. The problem is that I think it's only possible to create a plugin using CommonJS modules. I'm not an expert in JavaScript so I don't know if there's a workaround to transform ES6 modules to CommonJS modules. I was thinking about just copying the apca-w3.js file and just turn it into a CommonJS module but I don't know if it is possible because of the licensing. What should I do? It possible to create an npm package that comes with the same code but in CommonJS? Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @torres-developer thank you for writing. We are working on adding build tools so various flavors will be generated. If your plug in commercial or open source? |
Beta Was this translation helpful? Give feedback.
-
@Myndex Any chance of the BuildTools branch ever getting published to NPM (even if as a beta or using the "next" tag)? |
Beta Was this translation helpful? Give feedback.
Hello again!
I asked for help on a place for support/discussion on PostCSS and this is the conversation.
Because he said he wouldn't recommend it I assumed I can do it anyways. I looked the source code for PostCSS and I figured out how I can create the plugin using ES6 modules.
The plugin is open source. It's still in development but I think it's working good for now. I'm trying to use this library right so I don't generate wrong results.
Looking forward to make the plugin easy to use so people can easily write CSS where you just give the background color and it automatically chooses a good contrast color for the text depending on the text size, weight and usage (fluent, sub-fluent, ...)…