public class Less extends Object implements Jooby.Module
Transform less files to css via less4j.
LessCompiler
{
use(new Less("/css/**"));
}
styles.css:
@font-stack: Helvetica, sans-serif;
@primary-color: #333;
body {
font: @font-stack;
color: @primary-color;
}
A request like:
GET /css/style.cssor
GET /css/style.lessProduces:
body {
font: Helvetica, sans-serif;
color: #333;
}
A LessCompiler.Configuration object can be configured via .conf file and/or
programmatically via doWith(Consumer).
less.compressing = trueor
{
use(new Less("/css/**").doWith(conf -> {
conf.setCompressing(true);
}));
}
| Constructor and Description |
|---|
Less(String pattern)
Creates a new
Less module. |
Less(String pattern,
String location)
Creates a new
Less module. |
| Modifier and Type | Method and Description |
|---|---|
com.typesafe.config.Config |
config() |
void |
configure(Env env,
com.typesafe.config.Config conf,
com.google.inject.Binder binder) |
Less |
doWith(Consumer<com.github.sommeri.less4j.LessCompiler.Configuration> configurer)
Hook to finish/overwrite a less configuration.
|
public Less(String pattern, String location)
Less module.pattern - A route pattern. Used it to matches request against less resources.location - A location pattern. Used to locate less resources.public void configure(Env env, com.typesafe.config.Config conf, com.google.inject.Binder binder)
configure in interface Jooby.Modulepublic Less doWith(Consumer<com.github.sommeri.less4j.LessCompiler.Configuration> configurer)
configurer - A configuration callback.public com.typesafe.config.Config config()
config in interface Jooby.ModuleCopyright © 2015. All rights reserved.