Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected token return #10

Closed
kossnocorp opened this issue Apr 10, 2012 · 12 comments
Closed

Unexpected token return #10

kossnocorp opened this issue Apr 10, 2012 · 12 comments

Comments

@kossnocorp
Copy link
Collaborator

Screenshot illustrates the problem:

$ cat Gemfile.lock | grep sprockets
      sprockets (~> 2.0.3)
      sprockets
    sprockets (2.0.3)
  sprockets (~> 2.0.3)
@yury
Copy link
Collaborator

yury commented Apr 10, 2012

Can you also show your skim and slim versions?

@kossnocorp
Copy link
Collaborator Author

I'm sure problem is here, but I don't know how it affect latest sprockets.

@kossnocorp
Copy link
Collaborator Author

slim (1.2.0)
skim (0.8.1)

@yury
Copy link
Collaborator

yury commented Apr 10, 2012

It is very strange. It should be wrapped with function(){}. Here is my templates

(function() {
  this.JST || (this.JST = {});
  this.JST["import/field_form"] = (function() {

    return function(context) {
      if (context == null) context = {};
      return Skim.withContext.call({}, context, function() {

@yury
Copy link
Collaborator

yury commented Apr 10, 2012

@kossnocorp CoffeeScript.compile should definitely wrap src in function(){}.

@kossnocorp
Copy link
Collaborator Author

Yup, It's more than strange. Btw my fix (you can see it above) doesn't help.

@yury
Copy link
Collaborator

yury commented Apr 10, 2012

Please cat Gemfile.lock | grep coffee and try to rm -rf tmp/cache

@kossnocorp
Copy link
Collaborator Author

I don't know how, I don't know why, but problem is disappear after few server restarts. Sorry for bothering.

@kossnocorp
Copy link
Collaborator Author

After few hours of work, this issue is again bother me. This is my Gemfile.lock.

@kossnocorp
Copy link
Collaborator Author

This issue differently related to coffee-script-source version, that's why:

coffee-script-source (1.1.3):

$ irb
1.9.3p125 :001 > require 'rubygems'
 => false 
1.9.3p125 :002 > require 'coffee_script'
 => true 
1.9.3p125 :003 > CoffeeScript.compile('(context = {}) ->')
 => "\n  (function(context) {\n    if (context == null) context = {};\n  });\n" 

coffee-script-source (1.2.0):

$ irb
1.9.3p125 :001 > require 'rubygems'
 => false 
1.9.3p125 :002 > require 'coffee_script'
 => true 
1.9.3p125 :003 > CoffeeScript.compile('(context = {}) ->')
 => "(function() {\n\n  (function(context) {\n    if (context == null) context = {};\n  });\n\n}).call(this);\n" 

@kossnocorp
Copy link
Collaborator Author

This fix working well for me.

@yury yury closed this as completed in b308cae Apr 10, 2012
@yury
Copy link
Collaborator

yury commented Apr 10, 2012

Merged, thanks.

yury added a commit to yury/skim that referenced this issue Jun 4, 2013
Add `coffee-script-source >= 1.2.0` to dependencies (closes appjudo#10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants