catapult
catapult copied to clipboard
Adding multiple requires causes ArgumentError in sprockets
I'm getting this
1.9.3-p194/lib/ruby/gems/1.9.1/gems/sprockets-2.4.5/lib/sprockets/directive_processor.rb:206
:in process_require_directive: wrong number of arguments (7 for 1) (ArgumentError)
when my app.js
looks like this
//= require './vendor/underscore-min'
//= require './vendor/backbone-min'
//= require './backbone/app'
This is what is being sent to that process_require_directive
method in sprockets
["vendor/underscore-min", "//=", "require", "vendor/backbone-min", "//=", "require", "backbone/app"]
Thanks!!!!!!!!
sorry I'm not using Spine
There seems to be an issue (here) with the generated files. Coffeescript was also taking a crap in my lap.
After deleting -> retouching the files, everything works as expected. ^M? Weird stuff.
I will leave this to y'all to close.
This just bit me again. Super strange. Works with require_tree .
but when I add any other require directives it won't compile. Deleting the file and touching a new one fixes it...
This seems to be more related to sprockets rather than catapult, and you could get more help over there. Anyway, if you can provide a sample app I might take a look on it later.
Here's a sample repo https://github.com/pferdefleisch/broken-catapult in https://github.com/pferdefleisch/broken-catapult/tree/broken it won't watch or build for me
Write asset: ./public/assets/app.js
/Users/aaron/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/sprockets-2.4.5/lib/sprockets/directive_processor.rb:258:in `process_require_directory_directive': wrong number of arguments (4 for 1) (ArgumentError)
(in /Users/aaron/tmp/sample/assets/stylesheets/app.css:1)
in https://github.com/pferdefleisch/broken-catapult/tree/new_file I have yanked the text from the app.css
file, deleted it, created a new buffer, pasted and written the buffer, all in vim, and catapult builds.
Thanks
Your app.css at the broken
branch is using CR line terminators and it breaks when sprockets process it, while the new_file is using LF.
You could convert it to LF (recommended) or open an issue at the sprockets repo to fix it somehow.
AFAIK this is the only project that I use that generates files with CR terminators. So I am more apt to believe that it is a bug in catapult and not in Sprockets. What could be causing this? Maybe we can fix it. Is there a reason this project prefers CR?
Created an issue on Thor https://github.com/wycats/thor/issues/245 I want to get to the bottom of this :)
Thanks! Let's see what come out of it.
Hi, I had the same problem today.
Sprockets deliberately relies on LFs (String#lines()
uses $/
and it defaults to "\n"
).
I'm not sure if Sprockets should fix it by handling all line endings (they accept the default $/
which is flexible), neither I investigated if thor generates files with this problem, but I'm sure Catapult could generate valid files since this is a very annoying bug with a simple fix (I had no clue why that was happening and spent some time hunting this while reading Sprockets source code).
So late, but if anyone has a similar problem, mine was a malformed syntax:
//= require foo_//= require bar
Hope help someone.