I don't think my requirements are anything unusual. I want to develop
my Javascript code in several files organized by class. Ideally I
could serve these locally during development without calcdeps or the
compiler. When everything is working, I want to flip a switch, compile
everything, and deploy my all-inclusive minimized script.
From what I've read I would need to run calcdeps to create a deps file
for my code, and then remember to update it every time my requires
statements change. And then when I'm ready to deploy, I need compile
with a big fur-ball calcdeps/compiler command line, modify html, etc.
Sounds painful and error-prone.
I read mention of a replacement for calcdeps. How's that going? Is
anybody working to make the develop/deploy process easier?
Thanks,
Dave
I hear your pain - same story here, but I am closer to making some
progress now ;)
Take a look at this thread:
http://groups.google.com/group/closure-library-discuss/browse_thread/thread/4f4d80566736eed0
Probably the best thing to do is to get the unfinished book by Michael
Bolin (getting which by the way may present yet another challenge :).
safari online site seems to be only partially functional at some
network locations.
Other than that - get your hands on the calcdeps script, compiler and
JSDoc tags and calculating code maps.
Install closure inspector on a Firefox/Firebug (I yet have to find a
combination of FF/FB that works with the inspector - the latest
version does not work on my XP box)
Probably it is the most convenient is to complile code through the
calcdeps.py
Finally I wish google people adopted something better than this groups
software - quite impossible to find things unless you read every post
daily.
Anyway - I hope things will change in the future for the better. It's
quite always difficult to pick up technology that is just at the
beginning of the adoption wave.
Best regards,
Evgeny.
firefox & firebug - which versions work with the inspector - still a
mystery for me.
http://code.google.com/p/closure-library/w/list
wiki
http://my.safaribooksonline.com/9781449381882
closure: definitive guide
here I've posted an answer about using calcdeps.py to compile entire
project (I don't really care about stackoverflow votes, but I like
that you can highlight syntax more or less properly there)
http://stackoverflow.com/questions/1691969/how-to-use-googles-closure-to-compile-javascript/2367039#2367039
Please share your success stories!
Cheers.
Evgeny.
On Mar 3, 5:03 pm, Evgeny <evgeny.fad...@gmail.com> wrote:
> Hello Dave,
>
> I hear your pain - same story here, but I am closer to making some
> progress now ;)
>
> Take a look at this thread:http://groups.google.com/group/closure-library-discuss/browse_thread/...
ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/
On Mar 3, 5:28 pm, Evgeny <evgeny.fad...@gmail.com> wrote:
> http://code.google.com/closure/library/docs/calcdeps.html
> calcdeps.pyhttp://code.google.com/closure/compiler/docs/js-for-compiler.html
> JSDoc annotations for closure compilerhttp://code.google.com/closure/compiler/docs/inspector.html
> closure inspector
>
> firefox & firebug - which versions work with the inspector - still a
> mystery for me.
>
> http://code.google.com/p/closure-library/w/list
> wikihttp://my.safaribooksonline.com/9781449381882
> closure: definitive guide
>
> here I've posted an answer about using calcdeps.py to compile entire
> project (I don't really care about stackoverflow votes, but I like
> that you can highlight syntax more or less properly there)http://stackoverflow.com/questions/1691969/how-to-use-googles-closure...
In my ideal development scenario, I'd have a server that has a debug
mode and a production mode. In debug mode, it'd serve the raw files
directly. In production mode, it'd compile the scripts at boot-time
and served the compile bundle. Of course, it'd need to be smart enough
to find all the files and compute the dependencies between them.
I don't think we're anywhere near that right now. Things are getting
better, and as you noted Nathan is working on better versions of the
current tools.
I feel like the best deployment solutions will be the ones that
integrate well with a particular server engine or IDE or command-line
setup, so I'd be curious to know what you had in mind.
Nick
http://code.google.com/p/closure-library/wiki/GettingSartedWithClosure
I think there should be some guide that takes people to production
use as soon as possible without sugar-coating the difficult parts
or focusing too much on how you can get by without using all
the real tools like the compiler and inspector.
Something that has the right pointers, key links and explanation of
the
most difficult gotchas.
How do you make Inspector to work and load code maps?
The best I'm getting so far is error - "map cannot be loaded"
or something like that. I am giving it a valid url -
the same url works in the browser fine.
The inspector itself installed from the fifth attempt, but still can't
load maps.
I prefer to use compiler right from the outset because it gives
useful information right at the beginning and forces to document the
code properly. Not to say that it's pretty cool to build the
compressed code like that.
The hardest part so far has been to put all
the pieces together, not as much as the programming issues.
Hopefully we can put together some document that is right to
the point and really helps to get over these hurdles quickly.
Best wishes,
Evgeny.
On Mar 3, 7:53 pm, Nick Santos <nicksan...@google.com> wrote:
Dave
To unsubscribe from this group, send email to closure-library-discuss+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
the most helpful part for me was the book by michael bolin "closure
the definitive guide"
it's getting closer to be finished. All the other resources
(particularly links from the wiki and the project site) are helpful
too.
on the practical side here is what I do (but maybe there is a better
way)
I have two shell scripts, one of which calls closure compiler and
template compiler and another compiles just templates.
sometimes it helps to just recompile the templates.
the javascript you can run uncompiled in the development mode.
if your code modifications do not change dependencies, then you can
just refresh the browser window and reload changed sources
but any time you change templates they need to be recompiled.
I do not use closure inspector - never had luck with it yet - plus
there is no need
if you can have your browser load all the sources in uncompiled form
through dependencies.
I use closure compiler just to check my code, not to produce the
compressed output yet (but it can be done with an extra flag)
i'm still using calcdeps.py to create dependency script just for my
project files (but I've heard there is a better tool now)
Template compiler script:
#!/bin/sh
JAR_PATH=/path/to/lib/with/jars
rm soy_generated/*.js
#compile all soy templates so that output works with closure
java -jar $JAR_PATH/SoyToJsSrcCompiler.jar \
--outputPathFormat soy_generated/{INPUT_FILE_NAME_NO_EXT}.js \
--shouldProvideRequireSoyNamespaces \
`find soy -name '*.soy'`
Main compiler script
#!/bin/sh
CALCDEPS_PATH=/path/to/google-closure/closure/bin
JAR_PATH=/path/to/my/lib
CLOSURE_PATH=/path/to/google-closure
#SOY_PATH=/path/to/soy
#C_FLAGS='--compilation_level ADVANCED_OPTIMIZATIONS'
# --compiler_flags=$C_FLAGS \
# --compiler_flags="--compilation_level=ADVANCED_OPTIMIZATIONS" \
sh compile_soy
#for development I thow away the compiled script
#but use compiler warnings to check errors
$CALCDEPS_PATH/calcdeps.py --path=$CLOSURE_PATH \
--path=. \
--compiler_jar=$JAR_PATH/compiler.jar \
--input=main_script.js \
--output_mode=compiled \
--compiler_flags="--warning_level=VERBOSE"
\
> /dev/null
rm nmr-deps.js
$CALCDEPS_PATH/calcdeps.py --path=. \
--input=main_script.js \
--output_mode=deps \
> my-deps.js
#this perl script will do some path substitutions in the generated
deps file
#you'll have to adjust this so that paths are relative to goog/base.js
perl -pi -w -e "s/addDependency\('/addDependency('..\/..\/..\/myprog
\//" my-deps.js
finally, my html that I use for development looks like this (just the
outline, not exact code):
<html>
<head>
..... all the css needed for the UI, etc
<script src="goog/base.js">
<script src="my-project-deps.js">
<script src="my-main-script.js">
<!-- above is main uncompiled script the rest will be loaded by goog/
base.js using the deps file -->
</head>
<body>
<script>
launch_my_app();
</script>
</body>
</html>
Evgeny.