Open ismay opened 5 years ago
hey @ismay
sounds cool, i'll take a look when you have something.
i'm going to close this for now. i think it makes sense to wait until 1.0 is out and the API is stable before a cli can be made without continuous maintenance. i expect 1.0 to be out within a few weeks. i just pushed up a major rewrite.
Hi @leeoniya, sorry to reopen an old issue but I really like this tool and the only drawback I found (which is quite important in my use-case) is that there is no CLI^^
So here are my questions:
Thanks a lot
hey @HugoDelval
have you planned on doing one soon?
i personally use only the js api as part of my build scripts, so i had no concrete plans to make one myself.
Would you like a PR?
yes, that would be a great start!
Is there any specification for a CLI?
not really, but please use yargs-parser
instead of yargs
to keep the deps size down.
I've never done a JS cli but I'll try :) I'll keep the command line options as close as possible to purifycss and purgecss as I feel like they both are pretty good alternatives to this project!
I'll keep the command line options as close as possible to purifycss and purgecss
purifycss and purgecss do much more stuff than dropcss, so please design dropcss's CLI to follow its simple JS api rather than trying to match what others do.
I've never done a JS cli but I'll try :)
here's a CLI-only lib i'm working on: https://github.com/leeoniya/flecks/blob/master/cli.js
it probably needs to follow some more conventions like be placed in a /bin
directory and header similar to https://github.com/terser-js/terser/blob/master/bin/uglifyjs:
#!/usr/bin/env node
but the general idea is there.
Semi-helpful drive-by suggestion:
There are numerous similar tools, in various states of maintenance or abandonment. Regardless of the stability level, adding a CLI makes it more likely for people "shopping around" for a CSS cleanup solution that actually works, to quickly try this one. Making it easier for people to adopt increases the chances of someone adopting it heavily enough to become a contributor.
hey @kylecordes
by that logic, if i made webpack, gulp, postcss and many other plugins, then maybe dropcss would get enough adoption to get some contributions?
except that dropcss is a tool i made for myself and i don't use any of the other stuff people are asking for. as far as i know, dropcss is (so far) unsurpassed in speed, thoroughness and lib size. if people do not feel like those benefits are worth their time because it lacks a cli or a plugin, then they're welcome to use another solution.
i feel like i've put in enough high quality work into dropcss that anyone wanting to respect that (and needing a cli) would simply contribute. if not, then oh well - i'm not looking to become an unpaid maintainer of features in my own tools that i'll never use.
for those needing to "shop around" i spent the time to put up a live demo on Codepen, wich is front and center in the readme:
https://github.com/leeoniya/dropcss#live-demo-httpscodepenioleeoniyapenlvbryq
@minig0d
i think the overarching point is that i'm not interested in maintaining:
for instance, a cli would not be able to support the full API of dropcss (e.g. shouldDrop
cannot be a callback). lets say the cli's shouldDrop
only supported regexs. i have to figure out how to make sure they're properly escaped or i'll get support issues from users on different platforms if i get this even slightly wrong. i'll get questions about how to write specific regexs (just look at how much time PurgeCSS's author spends on issues showing people how to use write basic regexs).
all of these issues simply vanish when using the JS api, without wrappers, layers of additional conventions/configs/caveats. my tools are for those who know how to code. i'm not a node expert and it doesn't take a node expert to use fs
to read files from the disk and run them through dropcss. users who are unable or unwilling to do this are not my target audience - it's a great filter.
if someone wants to create and maintain a dropcss-cli
or webpack-plugin-dropcss
package/repo with dropcss as a dependency, then fantastic! but that person will not be me.
Just so many unknowns...
those are also unknowns to me. i don't know exactly which cases will break the parsers - they are not super robust and do not include error recovery or helpful messages - all these things are made abundantly clear in the intro. i have only tested dropcss against valid/common css and valid html (without embedded css or script tags). the advice is to try it and perhaps it will work for you.
And therefore will hurt your donation-base
i have at least thousands of users over many years across all my repos and no one has ever offered me a dime. i'm not looking for donors. a $50 donation would be a sweet gesture but monetarily silly, as it's a fraction of my billable hourly rate - and i've spent easily over 100 hours on dropcss alone. the best i can hope for is simple thank yous and to get valid bug reports with reduced testcases.
i'm happy to guide anyone who wants to build a cli or plugin for webpack, but it's a two way street. if people spent their time actually prototyping and/or discussing a CLI implementation rather than asking me to make one for them, then we would have a CLI by now :)
@leeoniya Please disregard that... I grossly misread your last reply... you mentioned contributions and I took that as donations and so on... Carry on :)
I was wondering if you've considered a separate cli version of dropcss. I was thinking of developing it when I have time, so I can use it to lint on my CI, and exit with an error if there's any unused css. Kind of like how I use prettier on CI. Would you mind if I create dropcss-cli?