星期日, 8月 09, 2015

[Java] Granule Asset 函式庫測試

記錄一下使用Granule來編譯js/css檔的過程,雖然專案有點舊了,但試用起來效果還不錯。
主要是看上有JSP Tag很好整合。

功能如下

  1. Combine and compresses JS and CSS using different methods: on fly or in build process, CSS and JS fast compression or more sophisticated Google Closure compression, or just simple file combining.
  2. No-lock in solution. The tag just put around existing scripts. The tag can be turn on/off on the different levels: page and application.
  3. Debug and production modes.
  4. Calculate dependencies using Closure Library package/namespace system.
  5. Can automatically choose optimization methods.
  6. Multiple combinations of JS/CSS even with different compression methods on one page.
  7. Support JSP includes.
  8. Several types of cache, memory and file.
  9. Automatically regenerates the bundle if you modify an included file.
  10. Proxy-friendly GZip support.
  11. Rewrites relative URLs in your CSS files.
  12. JSP, JSF, Grails integration.
  13. Multiple loggers support (SLF4J, Log4J, Apache Logger)
  14. Can be setup to preserve license headers of JS libraries.
  15. JDK1.5 and higher even for Google Closure Compiler.

安裝

星期五, 8月 07, 2015

[Java] Granule 解決tomcat8 檔案路徑回傳null問題

https://github.com/JonathanWalsh/Granule

最近找了這個工具來幫js/css瘦身,在tomcat 8下轉換assets file路徑會在getRealPath下產生Exception。

The parameter for getRealPath() is a 'virtual path' which - unfortunately - is a concept used in the Java docs but not actually defined anywhere. It is assumed to be a path to a resource in your web application and the separator in that case is always '/' regardless of platform.

解決方法要在html頁面引用javascript file時,要多加一個/





星期一, 8月 03, 2015

[Shellscript] 批次修改檔名


一行指令修改檔案: D 測試環境Mac OSX已ok

 find . -name '*.jpg' -exec sh -c 'mv "$0" "${0%.jpg}.png"' {} \;


For M$ windows可以參考這個軟體

其他你感興趣的文章

Related Posts with Thumbnails