The MinispadeFilter is pretty dumb about generating module identifiers by default. It just names them after the path of the input files. You're seeing the tmp dirs in there from handlebars and coffeescript because the minispade filter is getting the module id from the place where the pipeline turns them into javascript.
The filter takes a :module_id_generator
option which allows you to customize the generation of module ids. If you're not familiar with Ruby, this may be a little heavy for you, so bear with me. The module_id_generator option takes a Ruby proc, which is like an anonymous function in JS. The filter then takes this proc that you pass in and executes it for each input file, passing your proc a FileWrapper
object representing the input file, and your proc should return a string that will be used as the module id for that file.
Here's a match block from one of my projects:
match "**/*.js" do
minispade :module_id_generator => proc { |input| input.path.sub(/lib\//, 'timelog/').sub(/\.js$/, '') }
concat "js/app.js"
end
The :module_id_generator
is a proc which takes a FileWrapper
named input
and turns it into the module id I want. The input file's path is available as the path
method on input
. In this case, my JS files are in a lib/
directory, so I use Ruby's sub
method to replace the beginning lib/
part of the path with timelog
(the name of the project) then again to remove the .js
extension. So a js file named lib/models.js
would get a module id of timelog/models
.