wycats/rake-pipeline-web-filters — Issue #18: CoffeeScript causing odd problems
Author: Adman65
Created: 2012-02-19 18:09:51+00:00
State: open

Here is my asset file

```ruby
match "**/*.handlebars" do
handlebars
end

match "**/*.coffee" do
coffee_script
end

match "{javascripts,vendor/javascripts}/**/*.js" do
minispade :module_id_generator => proc { |input|
if input.path =~ /vendor/
File.basename input.path, '.js'
else
input.path.gsub(/javascripts\//, "todos/").gsub(/\.js$/, '')
end
}

concat "application.js"
end

match "**/*.{css,scss}" do
sass

concat "application.css"
end

match "public/**/*" do
copy do |input|
input.sub(/public\//, '')
end
end

match "images/**/*" do
copy
end
```

I have files like 'app/vendor/javascripts/backbone.js'. I'd like those turned to minispade modules named 'backbone'. This works sometimes.
I've been trying to track down the problem. The minispade modules are being written as: `vendor/todos/jquery`.

Seen here:

```
adam at mba : ~/projects/frontend_server_example[master*] % grep jquery public/application.js
});minispade.register('todos/boot', function() {minispade.require('jquery');
});minispade.register('vendor/todos/jquery', function() {/*!
```

Now after much debugging, I found the problem. I commented out the coffeescript section (I have no cofeescript files) and voila! Much to my surprise, the generated javascript is different:

```
adam at mba : ~/projects/frontend_server_example[master*] % grep jquery public/application.js
});minispade.register('todos/boot', function() {minispade.require('jquery');
});minispade.register('jquery', function() {/*!
```

^ **That's what I expect should happen**, but it doesn't happen when coffescript is there.

I really have no clue what is happening with this. It's a very odd bug from my point of view. So apparently the file names are changing even though the CS filter isn't being used?