Closed GoogleCodeExporter closed 8 years ago
Have you looked at the build command?
Original comment by bolinf...@gmail.com
on 27 Sep 2010 at 3:28
I have and I could not find a way to build (compile) soy files. Is this
possible? Can u point me to some doc or source code?
Original comment by guido.tapia@gmail.com
on 28 Sep 2010 at 6:20
It will compile the Soy files as part of the build process, but it will not do
the Soy->JS translation and write the JS files out. I could certainly extend
plovr to do that, but I am curious why you need the intermediate files? I find
it much more effective to use serve mode most of the time and then switch to
build mode before shipping, so I'm interested to learn what your workflow is.
Original comment by bolinf...@gmail.com
on 1 Oct 2010 at 2:26
Hi Michael,
I think having the ability to switch between debug and compiled mode quickly
would make a great enhancement to plovr.
Currently I have a set of build files I run that:
- Generate deps.js
- Compile soy
- Compile Javascript
- (And compile CSS using YUI compressor I think)
So every time I compile I automatically update all the soys, deps.js and my
minified css files.
In my html (which is server generated) I have a DEBUG=true (or false).
Changing this variable instantly changes my page from debug to compiled.
Thats it, a single boolean change and I'm now running my system in compiled
mode. I can do this on my dev box, test box, prod box, etc, etc.
Your 'serve' mode is good for a dev box but it is not compatible with the way I
like to have my project laid out (as described).
I know auto compiling (and generating compiled) soy is an issue as what will
you name them? Can I suggest you just add a .js to the filename. So test.soy
becomes test.soy.js.
I hope my debug/compiled design makes sense to you. Also Kudos to you on
plovr, if you make calcdeps.py redundant then you will be doing the world a
great service (it's a horrible tool).
Guido
Original comment by guido.tapia@gmail.com
on 2 Oct 2010 at 12:24
Are you familiar with the "mode" query parameter? It has the same values as the
property in the config file. By adding ?mode=RAW you can have debug mode and
?mode=ADVANCED you can use compiled mode. This works because plovr examines the
referrer.
Also, what are you using deps.js for?
Original comment by bolinf...@gmail.com
on 2 Oct 2010 at 1:07
Hi Michael,
This is what my server side page looks like. This is using spark
(http://sparkviewengine.com/) but it is synonymous with any server side Mvc
template engine.
The 2 variables at the top turn the page from:
- Compiled / Debug
- Offline (using appcache) / Online
I hope this simple example explains what I'm trying to achieve a bit better.
---------------------------------------------------------------------
<global type='bool' debug="true"/>
<var manifest="false" />
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" ${ manifest &&
System.Web.HttpContext.Current.User.Identity.IsAuthenticated ? "manifest=\"" +
Url.Content('~/Home.mvc/AppCacheManifest?debug=') + (debug ? "true" : "false")
+ "\"" : ""}>
<head>
<title>Test Application</title>
<if condition="debug">
<!-- DEBUG MODE:
Load base.js and then request all dependencies.
requirements.js Simply loads (goog.require) the entry point
-->
<script type="text/javascript" src="~/resources/scripts/lib/src/closure-library/closure/goog/base.js"></script>
<script type="text/javascript" src="~/resources/scripts/src/deps.js"></script>
<script type="text/javascript" src="~/resources/scripts/src/requirements.js"></script>
<!-- link each css file in the css directory -->
<link each="var f in System.IO.Directory.GetFiles(FallbackMockSession.GetCurrentRootDir() + '\\resources\\styles\\', '*.css').Where(f => f.IndexOf('.min.css') < 0)" type="text/css" rel="stylesheet" href="~/resources/styles/${ new System.IO.FileInfo(f).Name }" />
</if>
<else>
<!-- If compiled load compiled JS and compressed CSS -->
<script src="~/resources/scripts/scripts.min.js"></script>
<link href="~/resources/styles/styles.min.css" rel="stylesheet" type="text/css" />
</else>
<!-- Load any child template head contents -->
<use content="head" debug="debug" />
</head>
<body>
<div class="page">
<!-- Load child main content -->
<use content="view"/>
</div>
</body>
</html>
Original comment by guido.tapia@gmail.com
on 3 Oct 2010 at 12:06
Perhaps I'm still not understanding, but why can't you do:
<if condition="debug">
<!-- This will write out one script tag for each file in your build. -->
<script src="http://localhost:9810/compile?id=YOUR_CONFIG_ID&mode=RAW"></script>
</if>
<else>
<script src="js_file_that_was_built_with_plovr.js"></script>
</else>
This is the intended way of using plovr. You do not have to concern yourself
with base.js or deps.js when you use mode=RAW in this way.
Original comment by bolinf...@gmail.com
on 14 Oct 2010 at 5:02
Original comment by bolinf...@gmail.com
on 14 Oct 2010 at 5:02
Marking as WontFix. plovr is designed to generates files necessary for
development in server mode and to produce files necessary for production in
build mode.
Original comment by bolinf...@gmail.com
on 8 Nov 2011 at 1:35
Original issue reported on code.google.com by
guido.tapia@gmail.com
on 18 Aug 2010 at 10:46