Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove ckeditor sources from war file

  • Loading branch information...
commit a987c8a2bc9a7a6e050a770e8e721bfd100f7b4d 1 parent bc1b8c6
@stefanogualdi authored
View
9 grails-app/taglib/org/gualdi/grails/plugins/ckeditor/CkeditorTagLib.groovy
@@ -16,6 +16,8 @@
package org.gualdi.grails.plugins.ckeditor
+import grails.util.Environment
+
/**
* @author Stefano Gualdi <stefano.gualdi@gmail.com>
*/
@@ -25,8 +27,13 @@ class CkeditorTagLib {
static namespace = "ckeditor"
def resources = { attrs ->
- def minified = attrs?.minified ? attrs?.minified == 'true' : true
+ // In production always use minified version
+ def minified = true
+ if (Environment.current != Environment.PRODUCTION) {
+ minified = attrs?.minified ? attrs?.minified == 'true' : true
+ }
attrs.remove('minified')
+
def editor = new Ckeditor(request, attrs)
out << editor.renderResources(minified)
}
View
39 scripts/_Events.groovy
@@ -0,0 +1,39 @@
+/*
+* Copyright 2010 Stefano Gualdi
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import grails.util.Environment
+import org.codehaus.groovy.grails.plugins.PluginManagerHolder
+
+eventCreateWarStart = { name, stagingDir ->
+ if (Environment.current == Environment.current) {
+ // Remove ckeditor _source folder source
+ println "\n[CKEDITOR PLUGIN] Removing _source folder ...\n"
+
+ def version = PluginManagerHolder?.pluginManager?.getGrailsPlugin("ckeditor")?.version
+ if (version) {
+ def path = "${stagingDir}/plugins/ckeditor-${version}/js/ckeditor"
+
+ ant.delete(dir: "${path}/_source")
+ ant.delete(file: "${path}/ckeditor_basic_source.js")
+ ant.delete(file: "${path}/ckeditor_source.js")
+ }
+ else {
+ println "\n[CKEDITOR PLUGIN] Cannot remove _source folder!\n"
+ }
+
+ println "\n[CKEDITOR PLUGIN] _source folder removed.\n"
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.