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

Postcss support. #451

Open
iamfrntdv opened this Issue May 27, 2015 · 13 comments

Comments

Projects
None yet
8 participants
@iamfrntdv

iamfrntdv commented May 27, 2015

Hi! it would be great feature if harp could support postcss. is there any way to integrate postcss with harp?

@ai

This comment has been minimized.

ai commented May 27, 2015

PostCSS support will brings a Autopefixer support. For example, Google recommends Autoprefixer as a only way to handle vendor prefixes.

/cc @kennethormandy @sintaxi

@kennethormandy

This comment has been minimized.

Collaborator

kennethormandy commented May 27, 2015

Hey! Thanks for opening an issue. We actually already have Autoprefixer support built in, definitely agree it is the best way to approach that.

While I don’t think we’d be totally opposed to adding PostCSS, I have a hard time imagining how it would work. Harp tries to limit the amount of configuration you have to do, and to my (admittedly limited) knowledge of PostCSS, isn’t there almost always something you have to configure or determine about how you want the syntax to work?

I could see @sintaxi being interested in an Sass compatible version of PostCSS to avoid having to distribute the libsass binaries however.

@ai

This comment has been minimized.

ai commented May 27, 2015

@kennethormandy yeap, PostCSS runner need a plugins array as a config. Like:

postcss: [
    require('autoprefixer')({ browsers: ['last 2 versions'] }),
    require('cssnext')
]
@sintaxi

This comment has been minimized.

Owner

sintaxi commented May 28, 2015

Looks pretty nice. Pardon the rudimentary question, but what problem does postcss solve which isn't solved with scss?

@ai

This comment has been minimized.

ai commented May 28, 2015

@sintaxi you can do muuuuch more with PostCSS which is impossibe with Sass:

  • Autoprefixer
  • cssnext is like a Babel for CSS. You write a CSS4 and it will compile it to CSS3.
  • doiuse linter to test your CSS by Can I Use.
  • rtlcss to create a mirror design for Arabic/Hebrew versions
  • postcss-style-guide to generate components style guide automatically bby your CSS
  • postcss-data-packer to move all base64 inlined images to separated file

I can write many other plugins, that are impossible at Sass, but these are my favorite.

@iamfrntdv

This comment has been minimized.

iamfrntdv commented May 28, 2015

and as i know it is much faster than any of other existing css pre-processors. it is written in javascript and all plugins too, so there is a huge possibility of setting it up with custom plugins..

and it would be great if there was harp support so it could be used with any node.js app!

@kennethormandy

This comment has been minimized.

Collaborator

kennethormandy commented May 28, 2015

PostCSS looks very cool, and those are some awesome examples, thanks. Still, while I am personally interested in it, I don’t necessarily think it is a good fit with Harp (at least until we had some larger language plugin system #209). Harp specifically tries to avoid making you think about the kind of configuration that is a feature of PostCSS. We intentionally don’t even expose configurations for LESS or EJS for example.

That said, cssnext seems like the most natural fit if we were going to have some kind of PostCSS option, and we do have a PR for Babel open, which could pair nicely with it I suppose.

@iamfrntdv

This comment has been minimized.

iamfrntdv commented Jun 5, 2015

i agree with you that frameworks, plugins modules should stay simple and easy configured but at the same time there should be a option to add more configurations because they all written in some programming languages and it's a pity not to use all power of programming languages in our case javascript. On the other side there are always a lot of desktop apps that are easy configured...

What i would like to say with this?
A beginner in most cases will always start with some app because they are easy configured. When/If he levels up, he will switch from app to coding itself because there are much more flexible configurations which will satisfy his needs.

Harp is a great tool and it would be great if it could support PostCSS. Harp still can stay simple with LESS or SASS (for beginners or for those who just prefer LESS or SASS) but at the same time more configurable and more complex with PostCSS (for those who would like to use more complex and configurable toys))).

@iamfrntdv

This comment has been minimized.

iamfrntdv commented Jun 26, 2015

Hey guys, sorry for disturbing you! i just would like to know your finale thought about adding PostCSS to harp. Is it possible or you would like to keep Harp without PostCSS support? Thank you!

@igorshubovych

This comment has been minimized.

igorshubovych commented Sep 4, 2015

As far as I understood all processing is done in terraform:
https://github.com/sintaxi/terraform

Terraform is very opinionated (which is good), but you even currently configure Autoprefixer:
https://github.com/sintaxi/terraform/blob/master/lib/stylesheet/index.js#L63

This makes people creating tickets like this: #472.

@ai,
There is almost no configuration in harp. To configure PostCSS you need to define the flow of plugins, which is hard in JSON form. Also terraform has to require all of plugins, which I doubt they will do.
Maybe if CSSNext or CSSNano is widely adopted, they can include support for these set of plugins.

@gillchristian

This comment has been minimized.

gillchristian commented Feb 14, 2016

I agree with the idea of Harp being no-configuration based, and I love it. But I would not mind to have the option, say in the harp.json file, to add PostCSS (or Babel pluings, since they were mentioned in the thread) to run. And since PostCSS will not change the output if no plugins are passed to it, there is no problem to just add it to the pipe.

I use PostCSS daily on my workflow and I would love to be able to use it with Harp.

@svicalifornia

This comment has been minimized.

svicalifornia commented Jun 7, 2016

+1 for PostCSS support in Harp.

And I would also like to see more configuration options generally. Ruby's Middleman static generator is configurable via a Ruby config file, allowing a great deal of functionality and flexibility.

@stuartpb

This comment has been minimized.

stuartpb commented Jul 5, 2016

Whatever Autoprefixer rules Harp uses right now, they're not doing anything to adapt Flexbox properties (in fact, I don't see any prefixed properties in my output CSS). Is Harp's Autoprefixer just really out of date or something? Is it not processing files that already end in .css?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment