Archive for the ‘Javascript’ Category

IIS 7.5 and batman.js – .coffee not found

If you’re trying to get batman.js trying to run within visual studio & IIS 7.5 you’re going to run into some issues serving up coffeescript files to batman.

The error might look something like this:

Failed to load resource: the server responded with a status of 404 (Not Found)

From what I understand, IIS doesn’t know what type of MIME type coffeescript is, so it doesn’t serve it out, here’s what you need in your web.config for it to work properly (put in my whole web.config):

<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0"/>
  </system.web>
 
  <system.webServer>
    <httpErrors errorMode="Detailed" />
    <staticContent>
      <mimeMap fileExtension=".coffee" mimeType="coffeescript" />
    </staticContent>
  </system.webServer>
</configuration>

I gleaned some information from this SO article.

Thanks,
Ry

Eco (Embedded Coffee Script) Error – Unexpected dedent

Ran into this error when testing out eco (Embedded Coffee Script) templates.

Parse error on line #: unexpected dedent
(in c:/project/app/assets/javascripts/backbone/templates/dartboard.jst.eco)

Broken code:

<% if 7 > 3 %>
  teststring
<% end %>

Fixed Code:

<% if 7 > 3: %>
  teststring
<% end %>

Notice the colon, this is telling coffeescript that the next line is indented. It’s document here: https://github.com/sstephenson/eco it had just slipped my mind.

Ry

Return top