Reputation: 3435
I've been going through coffeescript documentation and stackoverflow to find answer for my question to no avail.
I have a javascript file containing just one literal object compiled from coffeescript.
products =
1:
name: 'foo'
id: 1
description: 'lorem ipsum dolor sit'
youtube: 'path
2:
name: 'bar'
id: 2
description: 'lorem ipsum dolor sit'
youtube: 'path
but what I'm getting back is:
(function() {
return products = {
1: {
name: 'foo lama',
id: 1,
...
I'm loading that file as a resource through ajax and I'm not able to use it as a proper JSON.
Is there a way to prevent coffeescript from wrapping the code into immediately invoked function or (and that'd be the best solution) is there a way to compile only JSON object without naming it?
Thanks
Upvotes: 1
Views: 338