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
CLI API? #154
Comments
It will be hard since postcss itself is just a parser (+ api). Seems useless without plugins (so new stuff to pass). That will make CLI usage very weird & verbose. |
@kevinSuttle I am not really big fun of “NPM as build tool”, because it is possible on very small cases. There is no working npm build solution for big projects. |
But maybe we can create
But how we can set options for plugins? For example browsers list for Autoprefixer? |
Great questions. I'm not sure. I'm just now moving off of gulp. Perhaps @keithamus would have some insight. |
@kevinSuttle so, why are you moving from Gulp? How you will build files throw several build tools (Sass, PostCSS, CSS compressor)? |
I'm dropping gulp too. Example here https://github.com/MoOx/frontend-hot-starterkit |
@MoOx you are not droping build tool ;). You use Webpack, instead of Gulp. You just change task runner. |
webpack is not a task runner, it mainly replace browserify. |
@MoOx but it is a asset build tool ;). Article mean, that we should replace build tool to npm. |
Indeed. But gulp is "just" a task runner (that can be used to handle your own build tool). |
I'm tired of having to fix/create gulp plugins ^^ |
@MoOx now you will fix/create WebPack plugins ;). For example |
I only use cssnext-loader & I won't have to do PR (I own it lol). But you are right. That being said, I try to have minimal dependency on each tool whenever I can. |
@ai The thinking is to remove another abstraction, and learn the CLI API of the tool you want to use. |
CLIs are awesome. Until somebody asks about Windows support. |
Maybe we can add some config like |
Forgive my ignorance, but is there something special about the way that the PostCSS and its plugins are designed that would prevent users from just calling the native tool they'd want to use (autoprefixer, cssmin etc)? http://blog.keithcirkel.co.uk/how-to-use-npm-as-a-build-tool/#runningmultipletasks |
@kevinSuttle many awesome plugins doesn't have CLI tool. Also use Autoprefixer as PostCSS plugin instead of CLI tool is much faster, because you will parse CSS once for many plugins. |
@kevinSuttle so, if you want to process file throw chain of several tools you will save file of each step to filesystem like it Grunt does? It will be very slow. |
Same thinking applies here: http://blog.overzealous.com/post/74121048393/why-you-shouldnt-create-a-gulp-plugin-or-how-to |
@kevinShuttle does system chains works with multiple files? Like |
Yes, just read the article. :) http://blog.keithcirkel.co.uk/how-to-use-npm-as-a-build-tool/#usingmultiplefiles |
Hmm, OK I will investigate more. So what everyone think about config? And who want to create |
I came here for this reason also. I'd love to see a cli. |
OK. Let’s talk about API.
You can use plugins with standard options by @MoOx @lydell @yisibl @kevinSuttle everything looks normal? I don’t like |
No cli tool should override a file without a specific option so |
I published postcss-cli module - I need it since we are using Make to build everything. I think the API is quite close to what's been discussed here. But it does not do stdout/stdin and multiple files. I am sure that can be easily added if people want it. You are welcome to comment, contribute, clone into postcss org or ignore ;-) |
@pirxpilot nice. But JSON config is a bad idea, because many plugins has a function options. |
I well make big list of issues if you decide to be CLI master after publish a npm module :-D. |
You're right. I am using yargs so .json comes for free - but if someone needs .js we can easily add it. |
I suggest to remove JSON config from API because many formats can confuse users. |
|
What @MoOx said, maybe follow the path browserify-shim uses for custom config: https://github.com/thlorenz/browserify-shim#c-config-inside-configshimjs-without-aliases, e.g. load some config by default ( |
@pirxpilot I created a issue in your repo. But most of them are not critical. They are just a TODO for future. Important for me is only: pirxpilot/postcss-cli#4 I added your CLI to PostCSS’s README: 7a5187b Thanks for nice work :). |
I think this should be reopened and PostCSS should have an official CLI...
It's extremely important PostCSS get an official CLI. It's the difference between installation/usage being:
And installation/usage being:
The point being, this should be a familiar/easy-to-use thing. I think someone else in this thread mentioned it, but npm scripts as build tool is becoming increasingly popular for good reason. They're insanely easy to setup and run in a plethora of ways... Anyway, just thought I'd whine and cry because PostCSS not having a CLI is a travesty. I honestly think if you moved away from the whole esoteric marketing scheme of "It does ✨ FuTuRe SyNtAx ✨ and Autoprefixer 💯 was built in it!!!1" and made it insanely easy for newbs to use it'd do wonders for PostCSS' adoption. That said, if it's a matter of work, I'd be happy to take this on. Give me a definitive syntax and some coding standards you'd like it to adhere to and I can get started on it whenever. 👍 |
@corysimmons Please see sindresorhus/ama#17 (comment) why we opposed to it. |
Separate CLI is a good thing, especially for those who use tools like gulp etc. |
@corysimmons I agree, that we should more think about user experience. I even think that current node.js culture ignores end-user experience and it is bad. But here is few problems:
|
@corysimmons what do you think is a main problem of current postcss-cli? Maybe API? Let's rationalize problem and find better solution. |
@ai Let me share my very first experience when my team and I decided to make the switch. We are a clojure/cljs shop which relies on https://clojars.org/ https://www.jfrog.com/artifactory/ and makefile. We did not want to add node to the mix in our apps, so I was tasked with using the unofficial postcss cli in a makefile. |
@stephenway You can always write issues or send prs. There is a product. To make it good for user we need to know what user want. |
@stephenway I do not like current I think you should start to collect current CLI problem. Or maybe you can write this issue to origin CLI author and think together. |
We already have three modules for |
Agreed. I'll work with the maintainer to make it better. I thought providing some perspective would help everyone understand the confusion. For the record, I'm in support of it being separate. |
TL;DR postcss-cli is in postcss org now, needs a maintainer I wrote postcss-cli to be able to use postcss and autoprefixer with Make. I never intended for it to become an official (whatever official means) CLI runner for postcss. I went in some trouble to add features to yargs to make handling config files easier. And I took quite a few patches that added features that - strictly speaking - were only needed if you want to use CLI tool independently from Make (globs, stdin/stdout, Windows compatibility, multiple files, watch functionality etc.) I always thought that if someone wanted to take the module in another direction they can fork it and work on it. It never happened. I recently realized that as long as postcss-cli lives in a different organization there might be a reluctance to do that. So this is what I am going to do: • I am forking code42day/postcss-cli into postcss organization. I won't be maintaining postcss/postcss-cli any more. Since I still need a tool like that, I will be maintaining postcss-cli-simple that would have a minimum set of features needed to use postcss with make. Thank you @AJ for postcss. And thanks to @FND @schoenwaldnils |
@pirxpilot Thanks for your work on it and thanks for migrating it over to postcss org. 👍 💯 Everyone else, a separate install is fine. @ai Please open issues at new repo so we can migrate this conversation over there and decide on an official syntax for it. |
@pirxpilot thanks for work, man :) |
I'm not finding much in the way of a CLI API, but I'd like to. Goal: to use PostCSS straight from NPM.
http://blog.keithcirkel.co.uk/how-to-use-npm-as-a-build-tool/
The text was updated successfully, but these errors were encountered: