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

In concatenated javascript (production), getting 'UnknownSprocketsDirectiveException' #142

Closed samuelcasas closed 10 years ago

samuelcasas commented 10 years ago

Hi, im getting the following error when i run the concatenated javascript, CSS runs as it should, but i cant get catched and concatenated javascript, it throws me an 'UnknownSprocketsDirectiveException', is there any info you need in order to reproduce the error?

Thanks and good job.

kdocki commented 10 years ago

@samuelcasas can you show me your manifest files? This exception is thrown when there is an unknown directive... this means you are likely doing something like

//= some_unknown_directive

or

/**
 *= foobar_cuz_it_dont_exist
 */
samuelcasas commented 10 years ago

Thanks for the fast response, here is my application.js: //= require vendor/mousetrap //= require vendor/jquery //= require vendor/moment //= require vendor/moment_es //= require vendor/underscore //= require vendor/angular //= require vendor/angular-route //= require vendor/restangular //= require vendor/angular-localstorage //= require vendor/jqueryui //= require vendor/sortable //= require vendor/ng-table //= require vendor/ui-bootstrap-tpl //= require vendor/daterangepicker //= require vendor/daterangepicker2 //= require_tree views //= require app/app //= require_tree app/directives //= require_tree app/configs //= require_tree app/controllers

when i run it in local environment, it runs as it should, i have it configured to load it not concatenated.

Thanks.

kdocki commented 10 years ago

@samuelcasas so when you are concatenating you are seeing the exception right?

When concatenation runs it is going to search through those included files for directives so that we can match any dependencies (this is using the depend_on directive). It sounds like one of the files has a //= or *= in it that has an unknown directive.

Can you verify this by turning on concatenation and then comment out each line in your application.js and then uncomment 1 at a time and see when the problem occurs.

samuelcasas commented 10 years ago

Oh, i did what you recommended me, the file that causes this problem is angular.js that i guess is something related to the comments that it has inside (in some way like the used to relate the directives from asset-pipeline, I use the development version, https://ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.js) or maybe the server ran out of memory, because the file is quite big.

Thanks.

samuelcasas commented 10 years ago

I did the same in production and i still have the same error, im running a Ubuntu server with Nginx and PHP 5.5.9.

Thanks.

kdocki commented 10 years ago

I haven't used angular.js in a long time so I haven't seen this issue. Anyway, I downloaded angular and tested it out to see if I could see the error. The problem is on line 5585,

    //================================

I will just require that there be a space in between directive names which will fix this issue.

kdocki commented 10 years ago

@samuelcasas let me know if that fixed it for you in dev-master branch...

samuelcasas commented 10 years ago

Well, now I'm using angularjs minified at the moment, but I'll switch to normal one in order to see if is working.

Thanks.

kdocki commented 10 years ago

@samuelcasas pretty sure this should fix your issue. if not though please re-open this ticket.