2009年11月18日水曜日

[Grails]ignore the excludePathPatterns parameter when using the Compress Plugin

In Grails environment, Compress Plugin ignore the excludePathPatterns option and filter doesn't work fine.
  • References
  • Description
    The Compress Plugin ignores the excludePathPatterns parameter even though I set the excludePathPatterns parameter in grails-app/conf/Config.groovy as follows, the Compress filter tries to compress for the css or pdf files. the css and pdf files should be exclude and disable the compression process for these files.
    (If you need to use the excludePathPatterns, the value of includePathPattern has to be set to null or empty.)
    includePathPatterns = []
    excludePathPatterns = [".*\\.css",".*\\.gif",".*\\.ico",".*\\.jpg",".*\\.swf",".*\\.pdf"]
  • Solution(Workaround)
    Change the plugin's source code as follows in CompressGrailsPlugin.groovy and recompile or rebuild the application. Please check the exclamation mark carefully.
    line and source code
    55 // excludePathPatterns configuration
    56 'init-param' {
    57 'param-name'("excludePathPatterns")
    58 //changed the source code from line:59 to line:60
    59 //if (compress && !compress["excludePathPatterns"] && compress["excludePathPatterns"].isEmpty()) {
    60 if (compress && compress["excludePathPatterns"] && !compress["excludePathPatterns"].isEmpty()) {
    61 'param-value'(compress["excludePathPatterns"].join(","))
    62 } else {
    63 'param-value'(".*\\.gif, .*\\.ico, .*\\.jpg, .*\\.swf")
    64 }
    65 }

0 件のコメント: