Closed streamich closed 3 years ago
Nope, at the monent, since it uses fs
module.
What a use case do you have?
I want to create an addon for nano-css
that in dev mode would automatically validate CSS and inform developer. Is there a lib you could recommend for that?
This module is a wrapper for CSSTree. You can use it for your purposes like that module does.
What if we separated CLI from the core (function which takes string and outputs array of zero or more error plain objects), then tapped that core in CLI, plus published the core using Rollup in CJS, ES Modules and UMD formats? Theoretically, people would be able to access that UMD build via browsers, maybe even straight from npm CDN's (for example, <script src="https://cdn.jsdelivr.net/npm/email-comb/dist/email-comb.umd.js"></script>
of mine).
Another problem with this CLI being bundled is that when I consume this package, my Rollup complains about path
and fs
dependencies — but I don't even use them via validateString()
! It's the bundled CLI that uses them, basically, all I need is validateString()
.
The benefit of this program is that it sugar-coats the AST traversal from people — which can cause brain haemorrhages for junior developers. Conceptually, it's genius: a function with string-in, array of zero or more error objects out.
It's just Rollup is needed and CLI must be separated.
Can this lib be used in a browser?