3

Curious if anyone has tried something like this/if it would work:

Many premium WordPress themes allow the administrator to change theme setting like color and typography and then (typically) either inject CSS directly into the header to override the defaults OR switch between a number of pre-set stylesheets.

Would it be possible to allow an administrator to instead use theme options to set base colors, typography rules, etc. and then use these to set LESS/SASS variables and run the compiler to spit out a completely new style.css file that would be rebuilt using those variables in the place of the default values (obviously we would also want a way to revert to the default).

I THINK this should be possible (and might actually be a great lightweight approach to allow for some pretty advanced customization) but I'm curious if anyone has tried something similar and what potential drawbacks I might run into.

  • Sounds like a great plugin idea... – Andrew Jul 10 '12 at 16:00
  • 1
    We're actually working on this now and will probably try to release it as a plugin. Stay tuned! – Adam Schweigert Mar 15 '13 at 15:53
  • Working on something similar, though you might not get too much reach on stack overflow since this isn't really a question. Either way, I've been working with the theme customizer API alot over the past few days, it's pretty incredible, I'll be using it and *NOT* the older WP settings API since it's so much more usable for the client. There are some interactions that concern me, mainly because you would need to hook the LessPHP compile action to the theme customizer SAVE action, which I anticipate would be the toughest part. – Brian Mar 17 '13 at 05:20

1 Answers1

0

This is certainly possible, though I have never done it personally. I would start out with a PHP less compiler like LESS PHP and use that both to compile the theme stylesheet and to re-compile based on options set in a WordPress admin menu.

Andrew
  • 2,084
  • 20
  • 32