Skip to content

Latest commit

 

History

History
110 lines (77 loc) · 4.2 KB

README.md

File metadata and controls

110 lines (77 loc) · 4.2 KB

Build Status Build Status Maven Central

Features

  1. Run-time support for namingStrategy configuration option.
  2. Configurable rendering of resource URIs. Provides resourceUriStrategy configuration option.
  3. Allows for rendering of external and protected unprocessed resources.
  4. Legacy code friendly. Tag library allows direct access to optimized resources.
  5. Wrapper-based implementation. Tag library shouldn't affect your wro4j customizations.
  6. Lazy-loading. Defer initialization of data until it's first required.
  7. Separate tag library context for web applications. Tag library stores it's data in servlet context scope.
  8. Exhausted caching of tag library data. Creates cache using cachingStrategy.
  9. Adaptable to resource changes. Supports resourceWatcherUpdatePeriod.

Usage

Prerequisites

  <listener>
    <listener-class>ro.isdc.wro.http.WroServletContextListener</listener-class>
  </listener>

  <filter>
    <filter-name>WroContextFilter</filter-name>
    <filter-class>ro.isdc.wro.http.WroContextFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>WroContextFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

Installation

  1. Add ContextListener to web.xml after WroServletContextListener
<listener>
  <listener-class>com.github.lifus.wro4j_runtime_taglib.servlet.TaglibServletContextListener</listener-class>
</listener>
  1. include the following tag library directive in every JSP in which optimized resources are used
<%@ taglib prefix="wro" uri="https://github.com/lifus/wro4j-runtime-taglib"%>
  1. Replace usages of optimized resources with tags
<wro:script group="all" />
<wro:stylesheet group="all" />

Configuration

Use wro.properties.

resourceUriStrategy

Default: versioned.

Resources that should be rendered. Specify one of the following values:

Value Description
versioned Render optimized resources and version their URIs
unoptimized Render unprocessed resources. Supported uriLocators are servletContext and uri.

optimizedResourcesRootStrategy

Default: inferred.

Strategy to find the root of optimized resources. Specify one of the following values:

Value
inferred Use value of the first url-pattern for the first WroFilter in web.xml
predefined Use value of optimizedResourcesRoot property in wro.properties

optimizedResourcesRoot

The root of optimized resources. Required when optimizedResourcesRootStrategy is predefined, ignored when optimizedResourcesRootStrategy is inferred.

Example: optimizedResourcesRoot=/wro/

resourceDomain

The domain that is used to serve resources to your users.

Example: resourceDomain=//your-cdn.com

License

This project is available under the Apache License, Version 2.0.