public DefaultWebResourceFilter(boolean isAmdEnabled) { this.javascriptWebResource = new JavascriptWebResource(isAmdEnabled); this.cssWebResource = new CssWebResource(isAmdEnabled); }
@Override public boolean matches(ResourceLocation resourceLocation) { if (resourceLocation.getName() != null) { // Creating CSS matcher with AMD enabled, because `RelativeUrlTransformerMatcher.matches` should match // LESS anyway, so it doesn't make any difference. CssWebResource matcher = new CssWebResource(true); return matcher.matches(resourceLocation.getName()) || resourceLocation.getName().endsWith(LESS_EXTENSION); } return false; } }
public void writeHtmlTags(Writer writer, UrlMode urlMode, final Predicate<WebResource> predicate, final Predicate<ResourceUrl> legacyPredicate) { writeSyncResources(writer); // Writing data resources. try { new DataTagWriter().write(writer, Iterables.filter(data, predicate)); } catch (IOException ex) { Support.LOGGER.error("IOException encountered rendering data tags", ex); } // Writing urls. List<WebResourceFormatter> formatters = Arrays.asList(new CssWebResource(config.amdEnabled()), new JavascriptWebResource(config.amdEnabled())); writeFormattedResources(writer, urlMode, new ContainerPredicate(predicate, legacyPredicate), formatters, false); }