CodeSleeve / asset-pipeline

This Laravel 4 package provides a very simple and easy to use asset pipeline. It was heavily inspired by the Rails asset pipeline. We make use of the wonderful Assetic package to help with pre-compliation!
http://www.codesleeve.com
MIT License
489 stars 53 forks source link

Coffeescript, TypeError: undefined is not a function #87

Closed x2luilop closed 10 years ago

x2luilop commented 10 years ago

When launching the application in production mode I get this in the chrome console: TypeError: undefined is not a function

I have this in the manifest //= require jquery //= require jquery.form //= require jquery.validate //= require additional-methods //= require bootstrap //= require_tree .

In the tree I have a master.js.coffee and uploads.js.coffee

Each file has the following:

$ -> console.log 'loaded'

If I only add one of the files I get no errors.

Any ideas?

kdocki commented 10 years ago

Bah... yeah. Okay. This doesn't have anything to do with coffeescript though. It has to do with semi-colons in the minify.

(function(){$(function(){return console.log('loaded')})}).call(this)

This is not valid because it is missing a semicolon which the Assetic\Filter\JSMinPlusFilter fails to put a semi-colon in there and thus blows up stuff.

I will write a filter called Codesleeve\AssetPipeline\Filters\JSMinPlusFilter to handle this the missing semi-colon.