[ 
https://issues.apache.org/jira/browse/TAP5-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13978005#comment-13978005
 ] 

Jochen Kemnade commented on TAP5-2325:
--------------------------------------

Then I'll happily provide my "workaround" for the meantime. It works for 
modules and goes like this:

{code:title=AppModule.java|borderStyle=solid}
  @Startup
  public static void warmMinifiedJavascriptCache(final ModuleManager 
moduleManager,
      final ResourceStreamer resourceStreamer, final StreamableResourceSource 
streamableResourceSource,
      final ResourceChangeTracker resourceChangeTracker, final 
JavaScriptStackAssembler javaScriptStackAssembler,
      @Symbol(SymbolConstants.MINIFICATION_ENABLED) final boolean 
minificationEnabled) throws IOException {

    if (minificationEnabled) {

      // the modules that should me minified upon the application startup
      String[] modules = new String[] { "moment", "codemirror/lib/codemirror" };

      // resolve the modules to actual resources
      List<Resource> resources = CollectionFactory.newLinkedList();
      for (String module : modules) {
        resources.add(moduleManager.findResourceForModule(module));
      }

      // request StreamableResource instances for all the resources to populate 
the cache
      for (Resource resource : resources) {
        streamableResourceSource.getStreamableResource(resource, 
StreamableResourceProcessing.COMPRESSION_DISABLED,
            resourceChangeTracker);
      }
    }
  }
{code}

> Minification cache warming
> --------------------------
>
>                 Key: TAP5-2325
>                 URL: https://issues.apache.org/jira/browse/TAP5-2325
>             Project: Tapestry 5
>          Issue Type: New Feature
>          Components: tapestry-core
>    Affects Versions: 5.4
>            Reporter: Jochen Kemnade
>
> It should be possible to configure that certain resources that should be 
> minified during the application startup, the rationale being that it can take 
> some time to minify large assets and that can lead to timeouts in requirejs 
> when the resource is requested for the first time.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to