batch file to merge .js files from subfolders into one combined file
Posted
by Andrew Johns
on Stack Overflow
See other posts from Stack Overflow
or by Andrew Johns
Published on 2010-04-15T16:45:07Z
Indexed on
2010/04/15
16:53 UTC
Read the original article
Hit count: 395
I'm struggling to get this to work. Plenty of examples on the web, but they all do something just slightly different to what I'm aiming to do, and every time I think I can solve it, I get hit by an error that means nothing to me.
After giving up on the JSLint.VS plugin, I'm attempting to create a batch file that I can call from a Visual Studio build event, or perhaps from cruise control, which will generate JSLint warnings for a project. The final goal is to get a combined js file that I can pass to jslint, using:
cscript jslint.js < tmp.js
which would validate that my scripts are ready to be combined into one file for use in a js minifier, or output a bunch of errors using standard output.
but the js files that would make up tmp.js are likely to be in multiple subfolders in the project, e.g:
D:\_projects\trunk\web\projectname\js\somefile.debug.js
D:\_projects\trunk\web\projectname\js\jquery\plugins\jquery.plugin.js
The ideal solution would be to be able to call a batch file along the lines of:
jslint.bat %ProjectPath%
and this would then combine all the js files within the project into one temp js file. This way I would have flexibility in which project was being passed to the batch file.
I've been trying to make this work with copy, xcopy, type, and echo, and using a for do loop, with dir /s etc, to make it do what I want, but whatever I try I get an error.
© Stack Overflow or respective owner