Class HtmlImportShim

java.lang.Object
org.nustaq.kontraktor.webapp.javascript.HtmlImportShim

public class HtmlImportShim
extends java.lang.Object
Created by ruedi on 16/07/15. inline all html imports of given file recursively (incl. adaption of pathes) optionally also minify javascript code on the fly. also inlines css files similar to polymer's vulcanize. by specifying 'no-inline=true' on a script tag one can exclude specific script tags
  • Constructor Details

    • HtmlImportShim

      public HtmlImportShim​(java.io.File baseDir, java.lang.String baseUrl)
    • HtmlImportShim

      public HtmlImportShim​(java.lang.String baseUrl)
  • Method Details

    • inline

      public HtmlImportShim inline​(boolean inline)
    • jsPostProcessors

      public HtmlImportShim jsPostProcessors​(java.util.List<JSPostProcessor> jsPostProcessors)
    • setJSPostProcessors

      public void setJSPostProcessors​(java.util.List<JSPostProcessor> JSPostProcessors)
    • locateResource

      public java.io.File locateResource​(KUrl urlPath)
    • setLocator

      public void setLocator​(HtmlImportShim.ResourceLocator locator)
    • shimImports

      public org.jsoup.nodes.Element shimImports​(java.lang.String htmlFile) throws java.io.IOException
      Throws:
      java.io.IOException
    • computeAssetPath

      protected KUrl computeAssetPath​(KUrl containingFileUrl, java.lang.String href)
    • shimImports

      public org.jsoup.nodes.Element shimImports​(KUrl containingFileUrl, java.util.HashSet<KUrl> visited, java.util.List<java.util.List<org.jsoup.nodes.Node>> bodyContent) throws java.io.IOException
      Throws:
      java.io.IOException
    • shimLink

      public void shimLink​(KUrl containingFileUrl, java.util.HashSet<KUrl> visited, java.util.List<java.util.List<org.jsoup.nodes.Node>> bodyContent, java.util.List<java.lang.Runnable> changes, org.jsoup.nodes.Element link) throws java.io.IOException
      Throws:
      java.io.IOException
    • inlineScripts

      public void inlineScripts​(KUrl containingFileUrl, java.util.HashSet<KUrl> visited, java.util.List<java.lang.Runnable> changes, org.jsoup.nodes.Element doc) throws java.io.IOException
      Throws:
      java.io.IOException
    • inlineScripts

      public void inlineScripts​(KUrl containingFileUrl, java.util.HashSet<KUrl> visited, java.util.List<java.lang.Runnable> changes, org.jsoup.select.Elements scripts) throws java.io.IOException
      Throws:
      java.io.IOException
    • stripComments

      public void stripComments​(org.jsoup.nodes.Document doc)
    • getBaseUrl

      public KUrl getBaseUrl()
    • stripComments

      public HtmlImportShim stripComments​(boolean stripComments)
    • minify

      public HtmlImportShim minify​(boolean minify)
    • main

      public static void main​(java.lang.String[] args) throws java.io.IOException
      Throws:
      java.io.IOException