Skip to content

Commit 3ec888b

Browse files
committed
Allowing subtyping
1 parent 38986e0 commit 3ec888b

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
# On-the-fly LESS compiler
22

33
This library defines an object you can bound in the URL space (via Stapler) to compile LESS files
4-
from classpath and serve them as CSS files.
4+
from classpath and serve them as CSS files. This enables modular web applications to compose
5+
their LESS files at runtime to enable late binding.
6+
7+
To use it, expose `LessServer` from your URL space (for example by binding it to a field of your "App" class.)
8+
9+
```
10+
class App {
11+
public final LessServer less_css = new LessServer();
12+
}
13+
```
14+
15+
Then request to `/less_css/foo/bar/zot.less.css` would compile and render `foo/bar/zot.less` in your classpath.
16+
To prevent leaking the class files and other potentially sensitive information inside the program, `LessServer`
17+
only serves `*.less` files.
518

6-
In this way, modular web applications can compose their LESS files at runtime to enable late binding.
719

820
This library relies on [lesscss-java](https://github.com/marceloverdijk/lesscss-java), which in turn uses
921
Rhino to run the original version of the less compiler. lesscss-java is in many ways poorly implemented,

src/main/java/org/kohsuke/stapler/less/LessServer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
* @author Kohsuke Kawaguchi
2020
*/
2121
public class LessServer {
22-
private final ClassLoader cl;
22+
protected final ClassLoader cl;
2323

2424
/**
2525
* Directory to store the generated CSS as cache.
2626
*/
27-
private final File cache;
27+
protected final File cache;
2828

2929
/**
3030
* Cache file we generate should have this timestamp, or else we need to regenerate the file.

0 commit comments

Comments
 (0)