I have found why it worked before and not in our new version.
In our earlier versions minification was not enabled apparently as it is
disabled by default. Later we added a dependency to tapestry-webresources.
This library enables minification in its module class. This explains why
it didn't cause any problems before.
Also I did not know minification was only used when the application was
set in Tapestry production mode. Explaining why it didn't work for some
builds and did for others.
Is there a reason tapestry-webresources does enable it by default, or
can I temporarily disable it again in my own module class until I find a
real solution?
Nathan
Op 12/03/2018 om 17:56 schreef Cezary Biernacki:
As far as I can tell, it is not directly supported, but you can override
existing minimizer and just disable minimisation for particular files, like
that:
In your *Module class add necessary contribution
@Contribute(ResourceMinimizer.class)
@Primary
public static void overrideJavaScriptMinimizer(final
MappedConfiguration<String, ResourceMinimizer> configuration) {
configuration.overrideInstance("text/javascript",
MyGoogleClosureMinimizer.class);
}
and define your minimisation class by extending GoogleClosureMinimizer and
overriding "isEnabled()" method with appropriate logic to disable
minimisation for specific files
public class MyGoogleClosureMinimizer extends GoogleClosureMinimizer {
@Override
protected boolean isEnabled(final StreamableResource resource) {
return super.isEnabled(resource) &&
!resource.getDescription().endsWith("/compatibility.js");
}
}
Notes:
- I have not tested this example code, so you might fix some details,
but I know that something similar should work (I wrote my custom JavaScript
minimizers for Tapestry 5.4);
- GoogleClosureMinimizer is part of Tapestry's internals, so be warned
that it might require extra porting to new Tapestry's versions;
- alternative approach is to replace global ResourceMinimizer service
(see org.apache.tapestry5.internal.services.assets.MasterResourceMinimizer
for default implementation) and your own logic to decide if minimisation
should be performed.
Best regards,
Cezary
On Mon, Mar 12, 2018 at 5:30 PM, Nathan Quirynen <
nat...@pensionarchitects.be> wrote:
Hi,
on our testing server we get the following error:
... JSC_PARSE_ERROR. Parse error. getters are not supported in older
versions of JavaScript. If you are targeting
newer versions of JavaScript, set the appropriate language_in option. at
StreamableResource<text/javascript
classpath:META-INF/assets/js/pdfjs/build/compatibility.js
COMPRESSABLE lastModifi
ed: Mon Mar 12 15:20:19 CET 2018 size: 50791> line 1732 : 0.
at org.apache.tapestry5.internal.webresources.GoogleClosureMini
mizer.doMinimize(GoogleClosureMinimizer.java:97)
at org.apache.tapestry5.internal.webresources.AbstractMinimizer
$1.perform(AbstractMinimizer.java:72)
at org.apache.tapestry5.internal.webresources.AbstractMinimizer
$1.perform(AbstractMinimizer.java:68)
at org.apache.tapestry5.ioc.internal.OperationTrackerImpl.perfo
rm(OperationTrackerImpl.java:110)
at org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.
perform(PerThreadOperationTracker.java:84)
at
org.apache.tapestry5.ioc.internal.RegistryImpl.perform(RegistryImpl.java:1266)
... It does not occur when running the same application on my local machine
in a Tomcat (same as on server).
Any idea what could be the problem here?
If no fix can be found, is there a way to tell Tapestry to not minimize
this specific file to maybe get it working that way?
Nathan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org