Coder Social home page Coder Social logo

tapestry-webjars's Introduction

No Longer maintained moving to node/graphql/react

Core Tapestry Webjars Module

Webjars are Javascript modules packages as jar files so they can easily be added as dependencies to Java projects. A large set of them are usable with require.js making them perfect for inclusion in Tapestry projects. All is that needed to access them is one and only one contribution to the ClasspathAssetAliasManager.

To make that happen this module does one thing and one thing only it makes that contribution. This allows multiple modules to use webjars but only add the alias once to the Tapestry IOC configuration. If every module that uses webjars tries to add the alias then difficult to fix startup errors will happen.

The following steps are needed to create a module that uses webjars:

Step one is to add the following to the pom file.

<dependency>
	<groupId>com.trsvax</groupId>
	<artifactId>tapestry-webjars-core</artifactId>
	<version>1.0.0</version>
</dependency> 

and one for the webjar

<dependency>
	<groupId>org.webjars</groupId>
	<artifactId>bootstrap-datetimepicker</artifactId>
	<version>2.3.5</version>
</dependency>

Next is the configuration need to make the Javascript a module

@Contribute(ModuleManager.class)
public static void setupBaseModules(MappedConfiguration<String, Object> configuration,
@Path("/META-INF/resourses/webjars/bootstrap-datetimepicker/2.3.5/js/bootstrap-datetimepicker.js")
Resource datetimepicker) {
	configuration.add("webjars/datetimepicker", new JavaScriptModuleConfiguration(datetimepicker));

}

Many newer modules support configuration/initialization thru data- attributes. If that's the case then nothing else is required.

If support is added in the Tapestry core this depenency can be replaces by the 2.0 verison which does nothing.

tapestry-webjars's People

Contributors

trsvax avatar

Watchers

 avatar James Cloos avatar  avatar

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.