ded / R2

a CSS LTR ∞ RTL converter for i18 friendly layouts
160 stars 29 forks source link

Create/enable plugins-like architecture #29

Open jbalsas opened 10 years ago

jbalsas commented 10 years ago

Currently r2 doesn't address icon fonts such as FontAwesome

Since this seems quite a specific, it doesn't exactly meet the requirements to land this in the core of r2. It's possible that someone doesn't use it at all, and also that someone using a different icon font could see their icons swap randomly.

We've created kind-of a prototype to swap FontAwesome 3 icons (https://github.com/liferay-labs/R2/commit/e3918ac10a507cbdd37f0b04c16d599d31c0c10f) which we're currently using.

We'd love to be able to improve that and contribute it back.

Do you think you'd be interested in something like this? Do you have any plans towards allowing such things?

Thanks for a great work, guys!

BYK commented 10 years ago

Oh, thank you for bringing this up!

I like the idea of plugins though I'm not use if we should have it in a folder in the package itself. I'd rather we have a convention such as Grunt plugins. I'll also look how ESLint does it and try to replicate that functionality.

BYK commented 10 years ago

I guess I'll choose the "Grunt way" which both has conventions and options for NPM packages and a local "extra tasks" directory.

I'll update the ticket once I have something working.

jbalsas commented 10 years ago

@BYK That sounds awesome!!

I completely agree about building a proper plugin architecture outside the r2 package. We just wanted to have something working and get the ball rolling ;)

As a bonus, it'd be useful if valueMap functions received some context such as within which declaration or rule are they. This would allow for more specific and conflict-free plugins.

jbalsas commented 10 years ago

Another important need for this, as we can see, is the possibility to register several plugins for the same valueMap functions. If functions receive context, then it's easy to just affect a selected group of rules, but more than one plugin may want to get a chance at changing the value of some property...

jbalsas commented 10 years ago

Hey @BYK,

Have you been able to make any progress on this?

Please, let us know if we could assist you in any way :)

BYK commented 10 years ago

Hey @jbalsas, thanks for following up! I'm sorry to keep you waiting though I had a pretty rough month. I plan to spend some time on this in the first half of March.

If you have any prototypes for such plugin system, I can use them as a start too. My plan is to have something similar to grunt's plugin system.

jbalsas commented 10 years ago

Hi @BYK, thanks for letting me know. We applied the temporary solution to our fork and that's what we're using for now with good results. Sadly, I got sidetracked with other stuff, so I couldn't work any further on this...

For reference, in case it helps with the specs for the architecture, you can check which kind of additional conversions we're applying in our plugins

I'll try to look into it again, but I'm not sure I'll be able to do that before March either. I'll keep you informed.

Thanks!