Class HtmlImportShim
java.lang.Object
org.nustaq.kontraktor.webapp.javascript.HtmlImportShim
public class HtmlImportShim extends 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
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceHtmlImportShim.ResourceLocator -
Constructor Summary
Constructors Constructor Description HtmlImportShim(File baseDir, String baseUrl)HtmlImportShim(String baseUrl) -
Method Summary
Modifier and Type Method Description protected KUrlcomputeAssetPath(KUrl containingFileUrl, String href)KUrlgetBaseUrl()HtmlImportShiminline(boolean inline)voidinlineScripts(KUrl containingFileUrl, HashSet<KUrl> visited, List<Runnable> changes, org.jsoup.nodes.Element doc)voidinlineScripts(KUrl containingFileUrl, HashSet<KUrl> visited, List<Runnable> changes, org.jsoup.select.Elements scripts)HtmlImportShimjsPostProcessors(List<JSPostProcessor> jsPostProcessors)FilelocateResource(KUrl urlPath)static voidmain(String[] args)HtmlImportShimminify(boolean minify)voidsetJSPostProcessors(List<JSPostProcessor> JSPostProcessors)voidsetLocator(HtmlImportShim.ResourceLocator locator)org.jsoup.nodes.ElementshimImports(String htmlFile)org.jsoup.nodes.ElementshimImports(KUrl containingFileUrl, HashSet<KUrl> visited, List<List<org.jsoup.nodes.Node>> bodyContent)voidshimLink(KUrl containingFileUrl, HashSet<KUrl> visited, List<List<org.jsoup.nodes.Node>> bodyContent, List<Runnable> changes, org.jsoup.nodes.Element link)HtmlImportShimstripComments(boolean stripComments)voidstripComments(org.jsoup.nodes.Document doc)
-
Constructor Details
-
Method Details
-
inline
-
jsPostProcessors
-
setJSPostProcessors
-
locateResource
-
setLocator
-
shimImports
- Throws:
IOException
-
computeAssetPath
-
shimImports
public org.jsoup.nodes.Element shimImports(KUrl containingFileUrl, HashSet<KUrl> visited, List<List<org.jsoup.nodes.Node>> bodyContent) throws IOException- Throws:
IOException
-
shimLink
public void shimLink(KUrl containingFileUrl, HashSet<KUrl> visited, List<List<org.jsoup.nodes.Node>> bodyContent, List<Runnable> changes, org.jsoup.nodes.Element link) throws IOException- Throws:
IOException
-
inlineScripts
public void inlineScripts(KUrl containingFileUrl, HashSet<KUrl> visited, List<Runnable> changes, org.jsoup.nodes.Element doc) throws IOException- Throws:
IOException
-
inlineScripts
public void inlineScripts(KUrl containingFileUrl, HashSet<KUrl> visited, List<Runnable> changes, org.jsoup.select.Elements scripts) throws IOException- Throws:
IOException
-
stripComments
public void stripComments(org.jsoup.nodes.Document doc) -
getBaseUrl
-
stripComments
-
minify
-
main
- Throws:
IOException
-