Reputation: 18958
How can I instruct google closure compiler to create a map file for my minified files that are in different folders preserving the right relative paths.
I cannot even specify a sourceRoot as option in sourcemap generation
I have a javascript file in /Js/common.js
and then some other files in /Admin/js/plugin.js
"C:\Program Files\Java\jre6\bin\java.exe" -jar "..\SolutionItems\Javascript\compiler.jar" --js ".\Js\Common.js" --js ".\Admin\assets\js\plugins.js" %* --source_map_format=V3 --js_output_file "./Admin/Asset/Js/admin.min.js" --create_source_map "./Admin/Asset/Js/admin.min.map"
this is the generated .map file
{
"version":3,
"file":"./Admin/Asset/Js/admin.min.js",
...
"sources":[".\\Js\\Common.js",".\\Admin\\assets\\js\\plugins.js"],
..
}
but it is misinterpreted by the browser because it use relative path from /Admin/Asset/Js/
and it try to find those js in /Admin/Asset/Js/js/common.js
and /Admin/Asset/Js//Admin/Asset/js/common.js
-----UPDATE-----
For future reference: if you don't want to copy the closure compiler to the js folder (like me) it is enought to change the current folder before calling it.
cd c:\Website\Admin\Asset\js
"C:\Program Files\Java\jre6\bin\java.exe" -jar "c:\SolutionItems\Javascript\compiler.jar"--js "../../../Js/Common.js" --js "plugins.js" --source_map_format=V3 --js_output_file "admin.min.js" --create_source_map "admin.min.map"
Upvotes: 0
Views: 1731
Reputation: 14411
Run the compiler from the admin/assets/js/
folder. You can specify output paths for the other resources.
Upvotes: 2