0

I compile .less files into minified .css files using gulp. There are some variables defined in the less files like this:

@error-red: #cc0000; 

I want to compile PHP placeholders into the minified css files, so the variables can be filled in later by a script. Something like this:

@error-red: <?php echo $error_red; ?>; 

Or even:

@error-red: php_errorred_placeholder; 

But the compilation fails because this is not valid CSS. Is there some other way to do this? The changes won't necessarily all be colors, but could also be borders or other rules.

I want to do this with PHP because node.js does not run on my production server.

KWeiss
  • 2,954
  • 3
  • 21
  • 37
  • I'll do it backwards. Use php to create/modify the .less file and create a gulp watch task to compile the css file when modified – Alwin Kesler Mar 01 '16 at 14:16
  • That would work, but the php tasks will use variables from a database that can be changed at moments when node.js is not available. – KWeiss Mar 01 '16 at 14:18
  • Ok, are you trying to modify css properties on the fly for your project? then why don't you use default color attributes in your less and generate a new css file with color properties only. Once generated, import it with a new `` tag. You don't need gulp for that – Alwin Kesler Mar 01 '16 at 14:25
  • I'll probably end up doing that if there's no way to do it with LESS. Thank you! – KWeiss Mar 01 '16 at 14:31

0 Answers0