12

I am trying to do some customisation on my existing bootstrap less file by importing import my own less file into existing bootstrap.less.

I thought it would be simple, however I've spend painful couple hours already to try to make new less compiled.

every time I add my file in I got:

ParseError: Syntax Error on line 1 in C:\xxx\content\bootst rap\less\xxx.form.less:9:999 8 }

My own less file:

.form-unit {
  background-color: #F5F5F5;
  border-radius: 6px 6px 6px 6px;
  margin-bottom: 30px;
  padding: 10px;
  min-height: 170px;
  position:relative;
}

Anyone have same problems? what did i missed???

I compiled it online not surprisingly it works, I am so confused on-line compile

D.J
  • 2,534
  • 4
  • 28
  • 43

4 Answers4

24

Are you using SimpLESS as your LESS compiler? If so there's a bug where it can't read files encoded in UTF-8 with BOM. Just convert your file to UTF-8 without BOM and it will work.

Chao
  • 3,033
  • 3
  • 30
  • 36
  • 2
    This also appears to be a problem with the 'official' lessc LESS compiler for Node. – Chris Jaynes May 17 '12 at 15:52
  • yep confirmed, and as @ChrisJaynes said same thing with lessc compiler – D.J May 28 '12 at 03:02
  • 1
    saved me from throwing my computer out the window, honestly. I did less css for a larger webbsite and all the sudden it just would not compile the files. so thanks :) – Dejan.S Jul 19 '12 at 05:56
  • 10
    Super thankful for this thread, though I'm still having problems! My file is utf-8 encoded, no BOM according to Vim. Has anyone else encountered this issue and found a different culprit? – Theresa Summa Aug 08 '12 at 15:36
  • I'm on a mac and don't know how to convert the file to a utf-8 without BOM.. any help? – Dries Marien Sep 05 '12 at 13:56
  • @DriesMarien Sorry i don't use macs so wouldn't know the specifics. Any half-decent text editor should have encoding options though. – Chao Sep 06 '12 at 10:26
  • Also be careful to add .less to your allowed resource extensions in .htaccess or other place where you are filtering resources! – Erdal G. Feb 13 '13 at 14:45
3

To anyone using Visual Studio and continuing to tear their hair out with the problem above (I've been in the same boat for the last hour or so, and the approved answer above didn't work for me), I'd recommend getting hold of the Web Essentials extension.

It allows for instant compilation of LESS files into minified CSS whenever they are saved in much the same way as SimpLESS does. No complaints about encoding, line endings or anything else!

Chris
  • 435
  • 3
  • 9
3

For all .less files used in Visual Studio, you need to change the UTF encoding....

File > Advanced Save Options...
Set "Encoding" to "Unicode (UTF-8 without signature) - codepage 65001

Once you do this, the Simpless compiler will work for your files.

Philip
  • 31
  • 1
0

If you are using Visual Studio, make sure that you didn't accidentally add the included file to the compile list. Check compilerconfig.json and make sure you aren't trying to compile both the main SASS file and the included one.

rooter
  • 189
  • 3
  • 11