I finally got this to work :)
- Step 1 - Download Less Php compile from github.
https://github.com/oyejorge/less.php
Step 2 - You just need one file Less.php from the package.
Step 3 - Now to set up your iframe, use bootstrap grid to write
php/html for the left sidebar and right iframe.
- Step 4 - To start, on the left side, which is the main page just add
a select box with font options - Arial, Open Sans .... Place the
select box in a form. This select box will be used as our first less
variable selector just for example.
Step 5 - Back to your iframe, the code below is an example
$parser = new Less_Parser();
$parser->parse( '@fontfam: <Post Your PHP variable here from Select using POST>; #header { font: @fontfam; } h2 { color: @color; }' );
$css = $parser->getCss();
<Write $css to a css file for example theme.css>
- Step 6 - Create an apply button that will just refresh the iframe -
Notice the iframe now picks up the new theme.css.
Viola - I tested this and is working. This is how you push less variable to an iframe.
Another way to do this is to use node.js (search it on github). The logic is almost the same and the use of node.js is that it does not need a broswer to run java scripts - the server can do it.