sstephenson / eco

Embedded CoffeeScript templates
MIT License
1.71k stars 70 forks source link

Line Break / Indentation Error in Windows #29

Closed bmarcaur closed 7 years ago

bmarcaur commented 13 years ago

Due to some restrictions on my current project I am forced to develop in a windows environment, this being said I have come across a windows specific parsing issue. When I run Eco.compile(File.read ("ANY FILE WITH A CONTROL STRUCTURE") ) I get an unexpected indent error, when I run this same command on my mac it compiles properly. The only control structure that doesn't error out is an if statement without an else statement. I am guessing that this is an issue with the windows line breaks causing the parser to improperly indent, but this is only a guess.

rayshih commented 13 years ago

seem that I have the same problem. I'm currently use spinejs and rails, when it come to windows, then the error message occured. Error: Parse error on line 2: Unexpected 'INDENT' (in {Rails_root}/app/assets/javascripts/admin/views/dashboard/contacts.jst.eco)

rayshih commented 13 years ago

And I found that it only occur while using block statement like <% for a in b: %> <% end %>

saulomendonca commented 12 years ago

I have the same problem using block statement <% for a in b: %> <% end %> in Windows seven

thyforhtian commented 12 years ago

I can confirm the problem exists on Windows. Works fine on Linux.

arjes commented 12 years ago

Experiencing the same issue

TravisBenning commented 12 years ago

Anyone have ideas on a work around / fix? Works fine on my Mac and Linux boxes but not Windows (XP or 7). Compiler issue? https://github.com/sstephenson/eco/blob/master/lib/compiler.js [line 15?] Preprocessor? https://github.com/sstephenson/eco/blob/master/lib/preprocessor.js [lines 63-71?] Util? https://github.com/sstephenson/eco/blob/master/lib/util.js [lines 8-23? maybe due to the way Windows handles end-of-line termination]

Just a few thoughts. Maybe I'm way off but I'd like to help resolve this.

bmarcaur commented 12 years ago

Hey guys,

This issue is being caused by a poorly implemented windows javascript compiler. To solve it simply install node and add it to your path. This will stop Eco from falling back on to 'wscript' (I think that is the name) and node handles and compiles Eco templates just fine.

Hope this helps

TravisBenning commented 12 years ago

@bmarcaur Thanks for the suggestion. I'll try that out.

bmarcaur commented 12 years ago

@TravisBenning No problem, I hope this solves everyones problems.

petersonfs commented 12 years ago

@bmarcaur The problem persist. Any solution?

bmarcaur commented 12 years ago

@petersonfs My suggestion above is what worked for me, so I haven't tried anything else.

petersonfs commented 12 years ago

It doesn't work for me. I'm running windows 7 x64.

bmarcaur commented 12 years ago

@petersonfs My environment was win7 x64 as well, I'm sorry this was part of an old project so I haven't needed to work on any other solutions.

ewinds commented 11 years ago

node.js worked for my win7 x64.

saturday commented 11 years ago

I have this same problem; however I'm on OSX and I have node installed.