Per this question: Setting up rake-pipeline for use with handlebars alongside Google App Engine
I’m using a MinispadeFilter as my dependency management system via rake-pipeline.
The weird thing I’m seeing is the coffeescript and handlebars files have their minispade identifier set to a tmp directory (I’m assuming, where the work is being done). screencast.com/t/wIXmREcreW
Is there a way to set that to a root path such that it is normalized? Likewise my js files, while not pointing to a tmp path, are pointing to the original assets path instead of the public path. I know its just an identifier, but should I expect them to reference the public path? screencast.com/t/k9kZNcPo
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_generatoroption 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 aFileWrapperobject 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:
The
:module_id_generatoris a proc which takes aFileWrappernamedinputand turns it into the module id I want. The input file’s path is available as thepathmethod oninput. In this case, my JS files are in alib/directory, so I use Ruby’ssubmethod to replace the beginninglib/part of the path withtimelog(the name of the project) then again to remove the.jsextension. So a js file namedlib/models.jswould get a module id oftimelog/models.