Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dropcss-cli tool #3

Open
ismay opened this issue Mar 27, 2019 · 11 comments
Open

dropcss-cli tool #3

ismay opened this issue Mar 27, 2019 · 11 comments
Labels
enhancement New feature or request

Comments

@ismay
Copy link

ismay commented Mar 27, 2019

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?

@leeoniya
Copy link
Owner

hey @ismay

sounds cool, i'll take a look when you have something.

@leeoniya
Copy link
Owner

leeoniya commented Apr 6, 2019

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.

@leeoniya leeoniya closed this as completed Apr 6, 2019
@HugoDelval
Copy link

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:

  • have you planned on doing one soon?
  • Is there any specification for a CLI? (I guess it should have the same look as others CLI like purgecss/purifycss etc..)
  • Would you like a PR?

Thanks a lot

@leeoniya
Copy link
Owner

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.

@leeoniya leeoniya reopened this Jul 22, 2019
@HugoDelval
Copy link

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!

@leeoniya
Copy link
Owner

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.

@leeoniya
Copy link
Owner

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.

@leeoniya leeoniya added the enhancement New feature or request label Jul 24, 2019
@kylecordes
Copy link

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.

@leeoniya
Copy link
Owner

leeoniya commented Feb 17, 2020

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

@leeoniya
Copy link
Owner

leeoniya commented Feb 17, 2020

@minig0d

i think the overarching point is that i'm not interested in maintaining:

  1. plugins for tools i don't use and have never used, and would have to learn
  2. an interface that's so easy to use that i will get flooded with support questions from people who wrote their first line of code last week.

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 :)

@minig0d
Copy link

minig0d commented Feb 17, 2020

@leeoniya Please disregard that... I grossly misread your last reply... you mentioned contributions and I took that as donations and so on... Carry on :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants