Grails ui-performance plugin not working with CKEditor - javascript

I installed Grails ui-performance plugin and made the necessary changes in the code. It didn't seem to work for development, I was getting files which name was ending with "_vnull" so I disabled it for development and tried to test with a WAR file. However, when generating the WAR file I get the following error and exception:
[ERROR] 1:0:Compilation produced 55 syntax errors. in lineSource: null sourceName: null
ERROR: problem minifying /Users/maricel/.grails/1.3.5/projects/community-services/stage/plugins/ckeditor-3.4.1.1-SNAPSHOT/js/ofm/scripts/languages/ca.js: Compilation produced 55 syntax errors.
org.mozilla.javascript.EvaluatorException: Compilation produced 55 syntax errors.
at com.studentsonly.grails.plugins.uiperformance.JsErrorReporter.runtimeError(JsErrorReporter.groovy:35)
at org.mozilla.javascript.Parser.parse(Parser.java:410)
at org.mozilla.javascript.Parser.parse(Parser.java:355)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:312)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.<init>(JavaScriptCompressor.java:533)
at com.studentsonly.grails.plugins.uiperformance.ResourceVersionHelper.versionAndMinifyJs(ResourceVersionHelper.groovy:230)
at com.studentsonly.grails.plugins.uiperformance.ResourceVersionHelper.this$2$versionAndMinifyJs(ResourceVersionHelper.groovy)
at com.studentsonly.grails.plugins.uiperformance.ResourceVersionHelper$this$2$versionAndMinifyJs.callCurrent(Unknown Source)
at com.studentsonly.grails.plugins.uiperformance.ResourceVersionHelper.applyVersion(ResourceVersionHelper.groovy:158)
at com.studentsonly.grails.plugins.uiperformance.ResourceVersionHelper.this$2$applyVersion(ResourceVersionHelper.groovy)
at com.studentsonly.grails.plugins.uiperformance.ResourceVersionHelper$_versionResources_closure1.doCall(ResourceVersionHelper.groovy:101)
at com.studentsonly.grails.plugins.uiperformance.ResourceVersionHelper.versionResources(ResourceVersionHelper.groovy:91)
at com.studentsonly.grails.plugins.uiperformance.ResourceVersionHelper.this$2$versionResources(ResourceVersionHelper.groovy)
at com.studentsonly.grails.plugins.uiperformance.ResourceVersionHelper$this$2$versionResources.callCurrent(Unknown Source)
at com.studentsonly.grails.plugins.uiperformance.ResourceVersionHelper.version(ResourceVersionHelper.groovy:44)
at com.studentsonly.grails.plugins.uiperformance.ResourceVersionHelper$version.call(Unknown Source)
at _Events.versionResources(_Events.groovy:36)
at _Events$_run_closure2.doCall(_Events.groovy:16)
at _GrailsEvents_groovy$_run_closure5.doCall(_GrailsEvents_groovy:58)
at _GrailsEvents_groovy$_run_closure5.call(_GrailsEvents_groovy)
at _GrailsWar_groovy$_run_closure5.doCall(_GrailsWar_groovy:327)
at War$_run_closure1.doCall(War.groovy:38)
at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
at gant.Gant.withBuildListeners(Gant.groovy:427)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at gant.Gant.dispatch(Gant.groovy:415)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.executeTargets(Gant.groovy:590)
at gant.Gant.executeTargets(Gant.groovy:589)
Error executing script War: org.mozilla.javascript.EvaluatorException: Compilation produced 55 syntax errors.
Is this some conflict with the CKEditor plugin? Any idea how to fix it?
Thanks for your help!

I fixed this issue by adding an exclusion for the plugins directory:
uiperformance.exclusions = [
"**/plugins/**"
]
As suggested in this nabble post

Related

Define local file

This project has to rely on older version of a SAP system. As a result some of the latest features do not work. I would like to have the "minutesStep" property of the latest "TimePicker" version, so I went to the source code and copied the latest TimePicker controls code to our old project.
I am having issues as "TimePicker" relies on the new version of "TimePickersliders" as well. I need to copy its source code as well. However I fail to make the "TimePicker" use the new "TimePickerslider" source code which I copied to the project as well.
sap.ui.define(['jquery.sap.global',
'sap/m/InputBase',
'sap/m/MaskInput',
'sap/m/MaskInputRule',
'sap/m/ResponsivePopover',
'sap/ui/core/EnabledPropagator',
'sap/ui/core/IconPool',
'sap/ui/model/type/Time',
'./TimePickerSliders'], // Here is the problem.
function(jQuery, InputBase, MaskInput, MaskInputRule, ResponsivePopover, EnabledPropagator, IconPool, TimeModel, TimePickerSliders) {
What should be the './TimePickerSliders' path, so that it includes the file in my project? Its in the same folder, but it just fails to pick it up.
Here is the Error I get:
Uncaught (in promise) Error: failed to load 'PROJECT_NAME/controls/MyTimePicker.js' from ./controls/MyTimePicker.js: Error: failed to load 'PROJECT_NAME/controls/Slider.js' from ./controls/Sliders.js: Error: failed to load 'PROJECT_NAME/controls/VisibleItem.js' from ./controls/VisibleItem.js: Error: failed to load 'PROJECT_NAME/controls/library.js' from ./controls/library.js: 404 - NOT FOUND
Is this even possible, reasonable or legal? I seem to be missing some other files as well.
If TimePickerSliders is a .js file located in your controls folder (I assume its on the same level as view and controller folders), try to call it like follows:
sap.ui.define([
...
'<project-namespace>/controls/TimePickerSliders'],
function(jQuery, InputBase, MaskInput, MaskInputRule, ResponsivePopover, EnabledPropagator, IconPool, TimeModel, TimePickerSliders) {

Bootstrap won't compile css SyntaxError: Cannot read property 'toCSS'

I am using Google App engine and Bootstrap 3 with an Ubuntu local environment. When I try to load a page the browser returns this error which I think is essentially saying less.js can't compile the .css file. Pre-compiled bootstrap is not used in my system as I pull in parts in our less and work from there. This error appears 10% of the time.
SyntaxError: Cannot read property 'toCSS' of null
in admin-bootstrap-theme.less
at http://127.0.0.1:8080/js/less.js:7952:30
at http://127.0.0.1:8080/js/less.js:7860:13
at callback.type (http://127.0.0.1:8080/js/less.js:7809:13)
at handleResponse (http://127.0.0.1:8080/js/less.js:7734:13)
at doXHR (http://127.0.0.1:8080/js/less.js:7754:9)
at loadFile (http://127.0.0.1:8080/js/less.js:7803:5)
at loadStyleSheet (http://127.0.0.1:8080/js/less.js:7827:5)
at loadStyleSheets (http://127.0.0.1:8080/js/less.js:7867:9)
at Object.less.refresh (http://127.0.0.1:8080/js/less.js:7944:5)
at http://127.0.0.1:8080/js/less.js:7970:6
Similarly, this error appears along side the first.
SyntaxError: Cannot read property 'toCSS' of null
in admin-bootstrap.less
at http://127.0.0.1:8080/js/less.js:7952:30
at http://127.0.0.1:8080/js/less.js:7860:13
at callback.type (http://127.0.0.1:8080/js/less.js:7809:13)
at handleResponse (http://127.0.0.1:8080/js/less.js:7734:13)
at doXHR (http://127.0.0.1:8080/js/less.js:7754:9)
at loadFile (http://127.0.0.1:8080/js/less.js:7803:5)
at loadStyleSheet (http://127.0.0.1:8080/js/less.js:7827:5)
at loadStyleSheets (http://127.0.0.1:8080/js/less.js:7867:9)
at Object.less.refresh (http://127.0.0.1:8080/js/less.js:7944:5)
at http://127.0.0.1:8080/js/less.js:7970:6
Finally, the more confusing part and also common part is this error which is much more common, without much of a stacktrace.
NameError: .box-shadow is undefined
in theme.less on line 28, column 3:
27 #shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 1px 1px rgba(0,0,0,.075);
28 .box-shadow(#shadow);
29
So I have tried reinstalling all my files with proper permissions. I recently updated python. I tried saving the files without a BOM as discussed in another post. Any help would be much appreciated.
I found the answer when my coworker and I were double checking our dependencies. Turns out that the version of less.js was very low 1.7.3. When we upgraded the compiler to 2.5.3 the compilation succeeded and everything was a success.

How should I do to identify an error point in assetic:dump of Symfony2?

This is an error of assetic:dump in Symfony2.
[Assetic\Exception\FilterException]
An error occurred while running:
'/usr/bin/java' '-jar' '/path/to/java/yuicompressor-2.4.8.jar' '--charset' 'UTF-8' '-o' '/tmp/YUI-OUT-NynbGd' '--type' 'js' '/tmp/YUI-IN-2GZ9rr'
Error Output:
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21)
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:635)
at java.util.ArrayList.get(ArrayList.java:411)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.getToken(JavaScriptCompressor.java:578)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.printSymbolTree(JavaScriptCompressor.java:1094)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.compress(JavaScriptCompressor.java:556)
at com.yahoo.platform.yui.compressor.YUICompressor.main(YUICompressor.java:186)
... 5 more
Input:
I think an error is somewhere of a script.
How should I do to identify an error point?
In the most cases the problem is occured by the parameters or paths. I had similar problem with assetic previously, then I managed to solve it using:
Try to figure it out from the documentation: http://symfony.com/doc/current/cookbook/assetic/yuicompressor.html
You can find the exact parameters in vendor/symfony/assetic-bundle/Resources/config/filters
Usually you have to play a bit with the assetic.java.bin or assetic.filter.yui_js.jar
Edit: it looks that you have forgotten to set the yui compressor path: "/path/to/java/yuicompressor-2.4.8.jar"

JCIFS Package Reference Error in Javascript

I am trying to use JCIFS to access file in a shared folder and it works perfectly fine using a java program. But when I try to use this code in a javascript which is embedded in a ant script file I get the below error. I do see the jcifs-1.3.17.jar in the classpath of ANT but still it is complaining of reference error (ReferenceError: "jcifs" is not defined.).
Appreciate your inputs/thoughts on this. Thanks in Advance!!!
2014-07-17 11:41:32,739 ERROR org.apache.bsf.BSFManager - Exception :
java.security.PrivilegedActionException: org.apache.bsf.BSFException: JavaScript Error: Internal Error: org.mozilla.javascript.EcmaError: **ReferenceError: "jcifs" is not defined.**
at java.security.AccessController.doPrivileged(AccessController.java:255)
at org.apache.bsf.BSFManager.exec(BSFManager.java:491)
at org.apache.tools.ant.util.optional.ScriptRunner.executeScript(ScriptRunner.java:100)
at org.apache.tools.ant.taskdefs.optional.Script.execute(Script.java:52)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:600)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: org.apache.bsf.BSFException: JavaScript Error: Internal Error: org.mozilla.javascript.EcmaError: ReferenceError: "jcifs" is not defined.
at org.apache.bsf.engines.javascript.JavaScriptEngine.handleError(JavaScriptEngine.java:195)
at org.apache.bsf.engines.javascript.JavaScriptEngine.eval(JavaScriptEngine.java:147)
at org.apache.bsf.util.BSFEngineImpl.exec(BSFEngineImpl.java:141)
at org.apache.bsf.BSFManager$6.run(BSFManager.java:493)
at java.security.AccessController.doPrivileged(AccessController.java:251)
... 19 more
Need to preface the package name with Packages.
https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino/Scripting_Java#External_Packages_and_Classes

How can I properly add jquery to Eclipse?

I'm importing jquery 1.8.17 js files to Eclipse Indigo, and I have been experiencing some problems. There's several errors in js files, like "missing semicolon", etc.
The problem is that I have to meet up deadlines, and I have to solve this issues ASAP. I suspect that I'm doing something wrong like not just copying the files to WebContent folder and referencing it in the jsp page.
As an example, I'm showing the firs line of the js file where several "missing semicolon" and "syntax error" is occouring:
*/(function(a,b){function d(b){return!a(b).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}function c(b,c){var e=b.nodeName.toLowerCase();if("area"===e){var f=b.parentNode,g=f.name,h;if(!b.href||!g||f.nodeName.toLowerCase()!=="map")return!1;h=a("img[usemap=#"+g+"]")[0];return!!h&&d(h)}return(/input|select|textarea|button|object/.test(e)?!b.disabled:"a"==e?b.href||c:c)&&d(b)}a.ui=a.ui||{};a.ui.version||(a.extend(a.ui,{version:"1.8.17",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(b,c){return typeof b=="number"?this.each(function(){var d=this;setTimeout(function(){a(d).focus(),c&&c.call(d)},b)}):this._focus.apply(this,arguments)},scrollParent:function(){var b;a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?b=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(a.curCSS(this,"position",1))&&/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0):b=this.parents().filter(function(){return/(auto|scroll)/.test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!b.length?a(document):b},zIndex:function(c){if(c!==b)return this.css("zIndex",c);if(this.length){var d=a(this[0]),e,f;while(d.length&&d[0]!==document){e=d.css("position");if(e==="absolute"||e==="relative"||e==="fixed"){f=parseInt(d.css("zIndex"),10);if(!isNaN(f)&&f!==0)return f}d=d.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),a.each(["Width","Height"],function(c,d){function h(b,c,d,f){a.each(e,function(){c-=parseFloat(a.curCSS(b,"padding"+this,!0))||0,d&&(c-=parseFloat(a.curCSS(b,"border"+this+"Width",!0))||0),f&&(c-=parseFloat(a.curCSS(b,"margin"+this,!0))||0)});return c}var e=d==="Width"?["Left","Right"]:["Top","Bottom"],f=d.toLowerCase(),g={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+d]=function(c){if(c===b)return g["inner"+d].call(this);return this.each(function(){a(this).css(f,h(this,c)+"px")})},a.fn["outer"+d]=function(b,c){if(typeof b!="number")return g["outer"+d].call(this,b);return this.each(function(){a(this).css(f,h(this,b,!0,c)+"px")})}}),a.extend(a.expr[":"],{data:function(b,c,d){return!!a.data(b,d[3])},focusable:function(b){return c(b,!isNaN(a.attr(b,"tabindex")))},tabbable:function(b){var d=a.attr(b,"tabindex"),e=isNaN(d);return(e||d>=0)&&c(b,!e)}}),a(function(){var b=document.body,c=b.appendChild(c=document.createElement("div"));a.extend(c.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),a.support.minHeight=c.offsetHeight===100,a.support.selectstart="onselectstart"in c,b.removeChild(c).style.display="none"}),a.extend(a.ui,{plugin:{add:function(b,c,d){var e=a.ui[b].prototype;for(var f in d)e.plugins[f]=e.plugins[f]||[],e.plugins[f].push([c,d[f]])},call:function(a,b,c){var d=a.plugins[b];if(!!d&&!!a.element[0].parentNode)for(var e=0;e<d.length;e++)a.options[d[e][0]]&&d[e][1].apply(a.element,c)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(b,c){if(a(b).css("overflow")==="hidden")return!1;var d=c&&c==="left"?"scrollLeft":"scrollTop",e=!1;if(b[d]>0)return!0;b[d]=1,e=b[d]>0,b[d]=0;return e},isOverAxis:function(a,b,c){return a>b&&a<b+c},isOver:function(b,c,d,e,f,g){return a.ui.isOverAxis(b,d,f)&&a.ui.isOverAxis(c,e,g)}}))})(jQuery);/*!
Try using the non-minified version of jQuery. At least then the locations of the errors will be legible.
It's available from here.

Categories

Resources