Pergunta

I use stylus and coffeeScript with django compressor, and It works perfectly in Dev. Here is my Jade template:

- load compress
!!! 5
html
    head
        title Super Page
        - compress css
        link(rel='stylesheet',type='text/stylus',href='{{STATIC_URL}}styles/base.styl')
        link(rel='stylesheet',type='text/stylus',href='{{STATIC_URL}}styles/style.styl')
        - endcompress
        - compress js
        script(type='text/coffeescript',src='{{STATIC_URL}}app/coolscript.coffee')
        script(type='text/coffeescript',src='{{STATIC_URL}}app/evencooler.coffee')
        - endcompress
    body
        block content

For deployment I use Heroku and Amazon S3 for static files. Once deployed I visit the site and the page loads fine and styles look as expected but the scripts are not working. Checking the <head> I see the styles were compressed into one css file but the coffeeScript files were not. The browser is fetching the CS source files:

<script type="text/coffeescript" src="http://supercoolapp.s3.amazonaws.com/static/app/coolscript.coffee"></script>
<script type="text/coffeescript" src="http://supercoolapp.s3.amazonaws.com/static/app/evencooler.coffee"></script>
I

It was working before, I had this problem once but I don't remember what was the cause, I think the compile process is failing silently and I don't know how to debug it.

Foi útil?

Solução

It was a not so easy to find coffeeScript problem. In my machine I was using coffeescript v1.4.X and heroku was using v1.6.3. I had a for own in array that v.1.4 allowed(it shouldn't) but v1.6.3 didn't(actually it didn't show the right error but a different one which is a bug shown here).

Anyway I solved the problem fixing the coffee file but I still think its a compressor error not to fail in production ignoring errors without giving any clue of what happened.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top