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

Export CLI as a module #7

Closed
jakubpawlowicz opened this issue Apr 21, 2017 · 0 comments
Closed

Export CLI as a module #7

jakubpawlowicz opened this issue Apr 21, 2017 · 0 comments
Milestone

Comments

@jakubpawlowicz
Copy link
Collaborator

So bin/cleancss looks something like:

#!/usr/bin/env node

var cleanCssCli = require('clean-css-cli');
return cleanCssCli(process);

One could reuse the CLI to do some custom magic:

#!/usr/bin/env node

var cleanCssCli = require('clean-css-cli');
return cleanCssCli(process, function beforeMinify(cleanCssObject) { /* do whatever magic you fancy */ });
@jakubpawlowicz jakubpawlowicz added this to the 4.1 milestone Apr 21, 2017
jakubpawlowicz added a commit that referenced this issue May 8, 2017
Why:

* It may become reusable this way.
jakubpawlowicz added a commit that referenced this issue May 8, 2017
Why:

* Slightly easier to get as we get more local variables.
jakubpawlowicz added a commit that referenced this issue May 8, 2017
Why:

* When used as a module a custom CLI implementation can hook into
  pre-minify configuration and alter it;
* it may be useful as a way of customizing CLI beyond command line
  arguments.
jakubpawlowicz added a commit that referenced this issue May 8, 2017
jakubpawlowicz added a commit that referenced this issue May 8, 2017
Why:

* When used as a module a custom CLI implementation can hook into
  pre-minify configuration and alter it;
* it may be useful as a way of customizing CLI beyond command line
  arguments.
jakubpawlowicz added a commit that referenced this issue May 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant