[MonoDevelop] Custom tools on multiple files

Michael Hutchinson m.j.hutchinson at gmail.com
Tue Jan 4 01:43:44 EST 2011


On Tue, Dec 21, 2010 at 3:50 AM, Federico Di Gregorio <fog at initd.org> wrote:
> Hi *,
>
> I am trying to automate the task of compressing web application assets
> (mainly CSS and JS files) into single files. I can do that using a build
> script and calling an external program but I'd like to have this
> functionality in a MD addin (adapting and hooking the script into every
> new project leads to errors while clicking on a file/folder and enabling
> an option is much better IMHO).
>
> I looked into custom tools (like the one defined by the T4 addin) but
> the problem is that ISingleFileCustomTool works on the source file and
> generates a derived file in the same directory. I need to work on a
> series of files (or on a folder) and generate a single file, like:
>
> xxx/js/jquery.js
> xxx/js/jquery.form.js
> xxx/js/...
>
> into:
>
> xxx/assets.js
>
> What's the best approach MD-wise?

I don't think there's any way to adapt "Generator" to this use case -
we're constrained by maintaining project format compatibility with VS.
Also, its intended use case is generating source files that can be
inspected and navigated within the IDE, consumed by code completion,
etc. - it sounds to me like your use case doesn't really require this,
and would be better served by a build task.

I would set a custom build action for these files - i.e. an msbuild
item type - then hook into the MD or msbuild build pipeline to
"compile" all files with this action. I might even add support for
additional item metadata that could be used to specify the target
compiled asset.

--
Michael Hutchinson
http://mjhutchinson.com


More information about the Monodevelop-list mailing list