1

I am working on lessphp compiler for my own development needs, here is what I am trying to achieve.

a) I have parent theme and child theme both have less files.

b) Using twitter bootstrap less files

c) Parent theme have twitter bootstrap less files

d) I am trying to use less files from parent theme in my child theme less file by using @import

I have tried: a) Passing paths as php variables by using lessphp setVariables(), and it gives me something like this.

i) @import "E:\wamp\personal\multisite/wp-content/themes/my-theme/bootstrap/variables.less";

ii) @import "E:\wamp\personal\multisite/wp-content/themes/my-theme/bootstrap/mixins.less";

code used:

@import "@{template_directory_path}/bootstrap/mixins.less"; 
@import "@{template_directory_path}/bootstrap/variables.less";

but its outputed as is in .css file instead of being imported as less file for parsing.

b) I tried to set directory search paths using lessphp addImportDir(), but it didn't worked either,

so anybody familiar with my situation, wanna help me out?

Syed
  • 148
  • 1
  • 16

1 Answers1

1

The issue is with encoding. The less compiler I was using needs the .less files to be encoded as UTF-8 without BOM. All of my files were encoded as UTF-8 with BOM. Once I changed the encoding the files started compiling as needed.

Reaction21
  • 661
  • 1
  • 5
  • 18
  • Thanks. Though I have started using alternative approach but would love to have this one working. – Syed Jun 12 '13 at 07:48
  • This isn't explained anywhere. I figured it out on my own. You can use Notepad++ to convert the encoding of files to other encodings. Make sure you set the less files to the proper encoding above and it will work for you. – Reaction21 Jun 13 '13 at 15:00
  • This problem shows up particularly often with WAMP, in my experience. – Daggar May 15 '15 at 19:03