Code Monkey home page Code Monkey logo

wro4j-runtime-taglib's Introduction

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.