Spring Boot jade4j Starter

This Starter provides you the minimal and required configuration to use jade templates as views in your Spring Boot application.

License

License

Categories

Categories

Spring Boot Container Microservices JADE General Purpose Libraries Utility
GroupId

GroupId

com.domingosuarez.boot
ArtifactId

ArtifactId

spring-boot-starter-jade4j
Last Version

Last Version

0.3.0
Release Date

Release Date

Type

Type

jar
Description

Description

Spring Boot jade4j Starter
This Starter provides you the minimal and required configuration to use jade templates as views in your Spring Boot application.
Project URL

Project URL

https://github.com/domix/spring-boot-starter-jade4j
Source Code Management

Source Code Management

https://github.com/domix/spring-boot-starter-jade4j

Download spring-boot-starter-jade4j

How to add to project

<!-- https://jarcasting.com/artifacts/com.domingosuarez.boot/spring-boot-starter-jade4j/ -->
<dependency>
    <groupId>com.domingosuarez.boot</groupId>
    <artifactId>spring-boot-starter-jade4j</artifactId>
    <version>0.3.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.domingosuarez.boot/spring-boot-starter-jade4j/
implementation 'com.domingosuarez.boot:spring-boot-starter-jade4j:0.3.0'
// https://jarcasting.com/artifacts/com.domingosuarez.boot/spring-boot-starter-jade4j/
implementation ("com.domingosuarez.boot:spring-boot-starter-jade4j:0.3.0")
'com.domingosuarez.boot:spring-boot-starter-jade4j:jar:0.3.0'
<dependency org="com.domingosuarez.boot" name="spring-boot-starter-jade4j" rev="0.3.0">
  <artifact name="spring-boot-starter-jade4j" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.domingosuarez.boot', module='spring-boot-starter-jade4j', version='0.3.0')
)
libraryDependencies += "com.domingosuarez.boot" % "spring-boot-starter-jade4j" % "0.3.0"
[com.domingosuarez.boot/spring-boot-starter-jade4j "0.3.0"]

Dependencies

compile (4)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-web jar 1.2.4.RELEASE
org.springframework : spring-core jar 4.1.6.RELEASE
de.neuland-bfi : spring-jade4j jar 0.4.2
de.neuland-bfi : jade4j jar 0.4.3

Project Modules

There are no modules declared in this project.

pug4j Spring Boot Starter

Build Status Coverage Status Apache License 2 Gitter


This Starter provides you the minimal and required configuration to use pug/jade templates as views in your Spring Boot application.

Behind the scenes, this starter uses the pug4j and spring-pug4j libraries.

Environment

JDK Spring Framework Spring Boot

Download

Maven Central Download

JCenter Download

GitHub, Factoids and Stats

Forks Release Issues


Usage

The usage is pretty straightforward as you can expect for any Spring Boot Starter

Add Maven dependency

build.gradle

...
dependencies {
  compile "com.domingosuarez.boot:jade4j-spring-boot-starter:2.0.4.RELEASE"
}
...

pom.xml

<project>
  ...
  <dependencies>
    <dependency>
      <groupId>com.domingosuarez.boot</groupId>
      <artifactId>jade4j-spring-boot-starter</artifactId>
      <version>2.0.4.RELEASE</version>
    </dependency>
  </dependencies>
</project>

Pug templates

Add the pug templates in the following directory

src
└── main
    └── resources
        └── templates
            └── index.pug

Then you can add new Spring MVC controllers as usual


Helpers

You can add helpers automatically using the annotation @PugHelper

package demo;

import com.domingosuarez.boot.autoconfigure.pug4j.JadeHelper;

@PugHelper
public class Util {
  public String format(double number) {
    return "some formating";
  }
}

template.pug

html
  head
    title Hello
  body
    h
    h1
      #{util.format(4)} # (1)
  1. The helper name’s is the Spring Bean id

Customize the helper’s name

You can customize the helper’s name using the PugHelper annotation

package demo;

import com.domingosuarez.boot.autoconfigure.pug4j.PugHelper;

@PugHelper("myId") // (1)
public class Util {
  public String format(double number) {
    return "some formating";
  }
}
  1. The new id

template.pug

html
  head
    title Hello
  body
    h
    h1
      #{myId.format(4)}

Configuration

The following settings are available:

Setting key Type Default value

spring.pug4j.checkTemplateLocation

Boolean

true

spring.pug4j.prefix

String

'classpath:/templates/'

spring.pug4j.suffix

String

'.pug'

spring.pug4j.encoding

String

'UTF-8'

spring.pug4j.caching

Boolean

true

spring.pug4j.prettyPrint

Boolean

false

spring.pug4j.mode

String

'HTML'

spring.pug4j.contentType

String

'text/html'

spring.pug4j.resolver.order

Integer

Ordered.LOWEST_PRECEDENCE - 50


Complete demo application

Please take a look into this application if you want to checkout a fully application.

Versions

Version
0.3.0
0.2.1
0.2
0.1.5