diff --git a/java/core/build.xml b/java/core/build.xml index a44456f..45cbddb 100755 --- a/java/core/build.xml +++ b/java/core/build.xml @@ -14,7 +14,7 @@ - + diff --git a/java/core/lib/greenscript-core-1.2.6k.jar b/java/core/lib/greenscript-core-1.2.6k.jar index be16f5d..e0761ac 100755 Binary files a/java/core/lib/greenscript-core-1.2.6k.jar and b/java/core/lib/greenscript-core-1.2.6k.jar differ diff --git a/java/core/lib/play-greenscript.jar b/java/core/lib/play-greenscript.jar index 5864171..a2a4a39 100755 Binary files a/java/core/lib/play-greenscript.jar and b/java/core/lib/play-greenscript.jar differ diff --git a/java/core/pom.xml b/java/core/pom.xml index b430a97..b1537a0 100755 --- a/java/core/pom.xml +++ b/java/core/pom.xml @@ -9,7 +9,7 @@ greenscript-core jar GreenScript Core - 1.2.6k + 1.2.6l A Java package to manage and process Web Resources (Javascript/CSS) http://github.com/greenlaw110/greenscript diff --git a/java/core/src/main/java/com/greenscriptool/Minimizer.java b/java/core/src/main/java/com/greenscriptool/Minimizer.java index 6f8304f..942d12f 100755 --- a/java/core/src/main/java/com/greenscriptool/Minimizer.java +++ b/java/core/src/main/java/com/greenscriptool/Minimizer.java @@ -424,7 +424,7 @@ public String processInline(String content) { public String processStatic(File file) { String content = null; try { - content = preprocess_(file, file.getPath()); + content = preprocess_(file); } catch (IOException e2) { logger_.error("error preprocess static file: " + file.getPath()); return ""; @@ -657,6 +657,27 @@ private boolean postMergeLessCompile_() { return Boolean.valueOf(System.getProperty("greenscript.lessCompile.postMerge", "false")); } + private String preprocess_(File file) throws IOException { + String s = null; + if (lessEnabled_() && !postMergeLessCompile_()) { + try { + s = compileLess_(file); + } catch (LessException e) { + logger_.warn("error compile less file: " + file.getName() + ", error: " + e.getMessage()); + } + } else { +// if (file.getName().endsWith(".coffee")) { +// try { +// s = coffee_.compile(fileToString_(file)); +// } catch (JCoffeeScriptCompileException e) { +// logger_.error("error compile coffee script file", e); +// } +// } + } + if (null == s) s = fileToString_(file); + return s; + } + private String preprocess_(File file, String originalFn) throws IOException { String s = null; if (lessEnabled_() && !postMergeLessCompile_()) { diff --git a/java/play/app/controllers/greenscript/Service.java b/java/play/app/controllers/greenscript/Service.java index 6358dcb..9000cee 100755 --- a/java/play/app/controllers/greenscript/Service.java +++ b/java/play/app/controllers/greenscript/Service.java @@ -5,6 +5,7 @@ import play.modules.greenscript.GreenScriptPlugin; import play.mvc.Controller; import play.mvc.Http; +import play.mvc.Scope.Flash; public class Service extends Controller { @@ -14,6 +15,7 @@ public static void getInMemoryCache(String key) { final long l = System.currentTimeMillis(); final String etag = "\"" + l + "-" + key.hashCode() + "\""; response.cacheFor(etag, "100d", l); + Flash.current().keep(); Map headers = request.headers; if (headers.containsKey("if-none-match") && headers.containsKey("if-modified-since")) { diff --git a/java/play/conf/dependencies.yml b/java/play/conf/dependencies.yml index 193ee13..848ab67 100755 --- a/java/play/conf/dependencies.yml +++ b/java/play/conf/dependencies.yml @@ -1,4 +1,4 @@ -self: play -> greenscript 1.2.6k +self: play -> greenscript 1.2.6l require: - play 1.2 diff --git a/java/play/documentation/manual/home.textile b/java/play/documentation/manual/home.textile index dc90145..1f08bfa 100755 --- a/java/play/documentation/manual/home.textile +++ b/java/play/documentation/manual/home.textile @@ -3,6 +3,10 @@ h1. GreenScript module The GreenScript module help you to manage javascript and CSS dependencies and do minimizing work in the same time. +h2. What's new for v1.2.6l + +* Bug fix: "relative URL convert breaks on linux when service static css file":https://github.com/greenlaw110/greenscript/issues/24 + h2. What's New for v1.2.6k * Fix a bug that cached content get cleared by accident @@ -19,14 +23,14 @@ h2. What's New for v1.2.6i * Bug fix: Rhino version conflict between LessEngine and YUICompressor * Support both .css and .less extension for stylesheet files * Enable last-modified timestamp check for resource files even greenscript.minimize is turned on. -* Fix bug: https://github.com/greenlaw110/greenscript/issues/18, e.g. support relative url path in css -* Fix bug: https://github.com/greenlaw110/greenscript/issues/19, e.g support Play.ctxPath -* Fix bug: https://github.com/greenlaw110/greenscript/issues/21 (found on v1.2.6h) +* Bug fix: https://github.com/greenlaw110/greenscript/issues/18, e.g. support relative url path in css +* Bug fix: https://github.com/greenlaw110/greenscript/issues/19, e.g support Play.ctxPath +* Bug fix: https://github.com/greenlaw110/greenscript/issues/21 (found on v1.2.6h) h2. What's New for v1.2.6 * Support LESS -* Fix bug: https://github.com/greenlaw110/greenscript/issues/18 +* Bug fix: https://github.com/greenlaw110/greenscript/issues/18 * CSS file will always get merged without regarding to greenscript.minimize setting h2. What's New for v1.2.5 @@ -43,8 +47,8 @@ h2. What's New for v1.2.4 h2. What's New for v1.2.3 * upgrade YUI compressor version from 2.4.2 to 2.4.6 -* Fix bug: 404 error while fetching cached files when change minimize/cache setting dynamically -* Fix bug: loaded logic breaks when minimize is enabled +* Bug fix: 404 error while fetching cached files when change minimize/cache setting dynamically +* Bug fix: loaded logic breaks when minimize is enabled h2. What's New for v1.2.2 @@ -60,7 +64,7 @@ h2. What's New for v1.2d ** Now: greenscript.dir.js=javascripts (suppose greenscript.dir.root=/public) ** Previously: greenscript.dir.css=/public/stylesheets ** Now: greenscript.dir.css=stylesheets (suppose greenscript.dir.root=/public) -* Fix bug: https://github.com/greenlaw110/greenscript/issues#issue/11 +* Bug fix: https://github.com/greenlaw110/greenscript/issues#issue/11 ** greenscript now support dependency management in modules (your css/js files in modules, your greenscript.conf file in moduels) * Support '.bundle' suffix in resource dependency configuration via greenscript.conf ** E.g. js.jq.bundle=http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js,http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.js @@ -70,7 +74,7 @@ h2. What's New for v1.2d h2. What's New for v1.2c -* Fix bug: dependency management breaks for complicated dependencies +* Bug fix: dependency management breaks for complicated dependencies * Support reverse dependency declaration (search for "reverse dependency declaration" in this document) h2. What's New for v1.2b @@ -79,7 +83,7 @@ h2. What's New for v1.2b h2. What's New for v1.2a -* Fix bug: IllegalStateException thrown out when app restart (in DEV mode) +* Bug fix: IllegalStateException thrown out when app restart (in DEV mode) h2. What's New for v1.2 diff --git a/java/play/src/play/modules/greenscript/GreenScriptPlugin.java b/java/play/src/play/modules/greenscript/GreenScriptPlugin.java index a90b338..9281e78 100644 --- a/java/play/src/play/modules/greenscript/GreenScriptPlugin.java +++ b/java/play/src/play/modules/greenscript/GreenScriptPlugin.java @@ -31,6 +31,7 @@ import play.mvc.Http.Request; import play.mvc.Http.Response; import play.mvc.Router; +import play.mvc.Scope.Flash; import play.utils.Utils; import play.vfs.VirtualFile; @@ -54,6 +55,8 @@ * fix bug: https://github.com/greenlaw110/greenscript/issues/18 * fix bug: https://github.com/greenlaw110/greenscript/issues/19 * fix bug: https://github.com/greenlaw110/greenscript/issues/21 + * fix bug: https://github.com/greenlaw110/greenscript/issues/23 + * fix bug: https://github.com/greenlaw110/greenscript/issues/24 * @version 1.2.5, 2011-08-07 * support in-memory cache * @version 1.2.1, 2011-01-20 @@ -63,7 +66,7 @@ */ public class GreenScriptPlugin extends PlayPlugin { - public static final String VERSION = "1.2.6k"; + public static final String VERSION = "1.2.6l"; private static String msg_(String msg, Object... args) { return String.format("GreenScript-" + VERSION + "> %1$s", @@ -264,6 +267,7 @@ public boolean serveStatic(VirtualFile file, Request request, Response response) if ("GET".equalsIgnoreCase(request.method)) { response.status = Http.StatusCode.NOT_MODIFIED; response.cacheFor(etag, "100d", l); + keepFlash_(); return true; } } @@ -308,6 +312,11 @@ public boolean serveStatic(VirtualFile file, Request request, Response response) // return l; // } + private void keepFlash_() { + Flash f = Flash.current(); + if (f != null) f.keep(); + } + private boolean processStatic_(VirtualFile file, Request req, Response resp, ResourceType type) { /* IRenderSession sess = type == ResourceType.JS ? jsSession() : cssSession(); @@ -328,6 +337,7 @@ private boolean processStatic_(VirtualFile file, Request req, Response resp, Res if (eTag_) { resp.setHeader(Names.ETAG, etag); } + keepFlash_(); return true; } else { return false; @@ -343,6 +353,7 @@ private boolean processStatic_(VirtualFile file, Request req, Response resp, Res if (eTag_) { resp.setHeader(Names.ETAG, etag); } + keepFlash_(); return true; } catch (Exception e) { Logger.error(e, "error compress file %1$s", file.getName());