asual / lesscss-engine Goto Github PK
View Code? Open in Web Editor NEWLESS Engine - A Java wrapper for less.js
Home Page: http://www.asual.com/lesscss
License: Apache License 2.0
LESS Engine - A Java wrapper for less.js
Home Page: http://www.asual.com/lesscss
License: Apache License 2.0
Hi
I'm worried about the private synchronized String call(Function fn, Object[] args) in https://github.com/asual/lesscss-engine/blob/master/src/main/java/com/asual/lesscss/LessEngine.java
IIUC, the Rhino call uses a ThreadLocal Context, so I believe the synchronized is useless and leads to a blocking compile.
Is there a reason for the synchronized ? I'd like to use the same LessEngine instance for all the compiles
thanks
Hi,
Is there a best practice to add dynamic @variable to engine ?
Let's say I have a file.less and would like to call:
It seems there is no bridge to change 'env'
I was trying to get the project to build in Eclipse and mistakenly downloaded Rhino 1.7R3 instead of 1.6R7. First - it doesn't work w/ 1.7R3 - everything seems to work except @import w/ Rhino 1.7R3. That said.. the error that it was throwing back to LessEngine had a null value for line, so the error was just a nullPointerException.
In LessEngine.java, line 160-162
if (ScriptableObject.hasProperty(value, "line")) {
line = ((Double) ScriptableObject.getProperty(value, "line")).intValue();
}
Just so I could get some more details on what the real error was, I changed it to...
if (ScriptableObject.hasProperty(value, "line") && ScriptableObject.getProperty(value, "line") != null){
line = ((Double) ScriptableObject.getProperty(value, "line")).intValue();
}
(the error was saying "eval" was not found in object [object object], more or less, but of course I had no line information, so it was hard to trace from there).
After some digging, I found I should just use Rhino 1.6R7 instead, which works just fine, but thought it was worth pointing out. Not a high priority. I downloaded 1.6R7 for now and the project builds and functions perfectly fine now. Thanks for a great servlet!
Compiling bootstrap occasionally results in a thread hung indefinitely in a busy loop. Usually it compiles in a few seconds, but i've been seeing it stuck for several hours at times.
Assuming that the problem is buried deep within either the LESS or Nashorn code a fix might be out of reach. I could detect the stuck thread and interrupt it with application code, but apparently nashorn doesnt check interrupt status. However, this can be done from within the JS. Would it be possible to insert something like this into some suitable processing loop?
if (java.lang.Thread.interrupted()) break;
See commentary about interrupting Nashorn scripts here - http://stackoverflow.com/questions/24855182/interrupt-java-thread-running-nashorn-script
Thread stack is probably not much help, its mostly lamdas:
java.lang.Thread.State: RUNNABLE
at jdk.nashorn.internal.runtime.ScriptRuntime.EQ_STRICT(ScriptRuntime.java:767)
at jdk.nashorn.internal.runtime.ScriptRuntime.NE_STRICT(ScriptRuntime.java:779)
at java.lang.invoke.LambdaForm$DMH/1653016297.invokeStatic_LL_I(LambdaForm$DMH)
at java.lang.invoke.LambdaForm$MH/1620750378.convert(LambdaForm$MH)
at java.lang.invoke.LambdaForm$MH/1064733140.linkToCallSite(LambdaForm$MH)
at jdk.nashorn.internal.scripts.Script$^eval_$2._L15$Parser$getLocation(:310)
... many more...
at java.lang.invoke.LambdaForm$MH/522631210.linkToCallSite(LambdaForm$MH)
at jdk.nashorn.internal.scripts.Script$^eval_._L12(:64)
at java.lang.invoke.LambdaForm$DMH/883214287.invokeStatic_LLLLL_L(LambdaForm$DMH)
at java.lang.invoke.LambdaForm$MH/664550332.invokeExact_MT(LambdaForm$MH)
at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:504)
at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:206)
at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:378)
at jdk.nashorn.api.scripting.ScriptObjectMirror.call(ScriptObjectMirror.java:107)
at com.asual.lesscss.compiler.NashornCompiler.compile(NashornCompiler.java:77)
at com.asual.lesscss.LessEngine.compile(LessEngine.java:107)
at com.asual.lesscss.LessEngine.compile(LessEngine.java:101)
I am using lesscss dependency and it uses Rhino 1.7R4
com.asual.lesscss
lesscss-engine
1.5.1
I am getting the following error:
org.mozilla.javascript.EcmaError: TypeError: Cannot find function bind. (file:/opt/tomcat/webapps/ABC/WEB-INF/lib/lesscss-engine-1.5.1.jar!/META-INF/source-map.js#152)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3350)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3340)
at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3356)
at org.mozilla.javascript.ScriptRuntime.typeError1(ScriptRuntime.java:3368)
at org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3428)
at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2052)
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3081)
at script(file:/opt/tomcat_8_5_28/webapps/ABC/WEB-INF/lib/lesscss-engine-1.5.1.jar!/META-INF/source-map.js:152)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2394)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:173)
at org.mozilla.javascript.Context.evaluateReader(Context.java:1227)
at com.asual.lesscss.compiler.RhinoCompiler.(RhinoCompiler.java:32)
at com.asual.lesscss.LessEngine.(LessEngine.java:84)
Hi,
would you consider deploying your artifact to Maven Central.
The reason I'm asking is, that I would like to write a Maven build plugin using your code and putting it there will make my life a lot easier.
I've deployed to Central a couple of times myself and have gone through Sonatype, which I can recommend: https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide
Thanks
Lenni
The pattern StreamResourceLoader#PATTERN
matches on line line 49 on Windows paths but I guess it should'nt. If I'm right the pattern should identify URI schemas?!
In LessEngine#compile(input,compress)
the location will be declared as the absolute path of the given file (line: 155). That means on a Windows machine C:\\<path>
will be passed to StreamResourceLoader#exists(path)
and the matcher macthes C:
and of course there is no ResourceLoader
which a schema C
.
What was working for me is changing the PATTERN
to:
private static final Pattern PATTERN = Pattern.compile("^([\\w]{2,}):(.*)");
means that there should be at least 2 characters before :
and thats the case for all current schemas. Should it be changed or are there other solutions?
After that changed, another errors occured and maybe Windows paths are the problem as well.
Problem:
I'm trying to convert test.less
with following content:
@import "another.less";
The import file is in the same folder and just empty for testing. As soon as I pass test.less
as File
object, following exception occurs:
Exception in thread "main" com.asual.lesscss.LessException: com.asual.lesscss.LessException: Syntax Error: java.lang.IllegalArgumentException: protocol = http host = null (line -1, column -1) near
at com.asual.lesscss.LessEngine.parseLessException(LessEngine.java:218)
at com.asual.lesscss.LessEngine.compile(LessEngine.java:181)
at com.asual.lesscss.LessEngine.compile(LessEngine.java:168)
at test.Main.main(Main.java:23)
Caused by: com.asual.lesscss.LessException: Syntax Error: java.lang.IllegalArgumentException: protocol = http host = null (line -1, column -1) near
at com.asual.lesscss.LessEngine.parseLessException(LessEngine.java:216)
at com.asual.lesscss.LessEngine.compile(LessEngine.java:163)
at com.asual.lesscss.LessEngine.compile(LessEngine.java:173)
... 2 more
My Test.java
public class Test{
public static void main(String[] args) throws LessException, IOException {
File input = new File("test.less");
LessEngine engine = new LessEngine();
engine.compile(input);
}
}
BUT, if I pass a URL
instead of a file File
it works.
Cheers,
Christian
It would be great to publish the lesscss-engine to the central repository.
I know that it's already deployed to http://www.asual.com/maven/content/repositories/releases/,
but it would be great to not have to add a repository to the pom of each project using the lesscss engine.
Cheers
org.mozilla.javascript.EcmaError: TypeError: Cannot find function bind in object
[exec] function (deps, callback) {
[exec] if (Array.isArray(deps)) {
[exec] var params = deps.map(function (dep) {
[exec] return this.lookup(dep);
[exec] }, this);
[exec] if (callback) {
[exec] callback.apply(null, params);
[exec] }
[exec] return undefined;
[exec] } else {
[exec] return this.lookup(deps);
[exec] }
[exec] }
. (file:/Users/martinschaaf/Documents/workspace.main/my_datameer/lib/lesscss-engine-1.5.1.jar!/META-INF/source-map.js#152)
I get this on less compilation with version 1.5.1. Version 1.4.2 worked before.
It works like an @import .less and writes css text into main file, but directive must be left as is.
(I execute com.asual.lesscss.LessEngine.main() with in and out files)
Hi, this is not really an issue/bug. But rather a question how to proceed.
I created a resourceHandler for JSF 2 to process/serve less files.
The LessResource is accountable for serving up the compiled less resource.
When using the @import directive, the engine is unable to find the file. This sounds logical, how could the LessEngine know where to find the imported resource?
The error is the following:
com.asual.lesscss.LessException: org.mozilla.javascript.EcmaError: TypeError: Cannot call method "replace" of undefined (/../META-INF/less.js#2517)
at com.asual.lesscss.LessEngine.parseLessException(LessEngine.java:188)
Question, what is the best approach to include an imported file.
Regards,
Duncan
Any plan to add support for the latest lesscss which is 2.2.0?
Any reason why this might happen?
It's probably something to do with how I'm loading the library using "Javaloader.cfc" but who knows...
I'm using 1.3.0
Message TypeError: Cannot call method "toCSS" of undefined (file:/F:/<site path>/plugins/lessengine/lib/lesscss-engine-1.3.0.jar!/META-INF/engine.js#36)
Cause com.asual.lesscss.LessException
Stacktrace The Error Occurred in file:/F:/Sites/ccpd-dev/plugins/lessengine/lib/lesscss-engine-1.3.0.jar!/META-INF/engine.js: line 36
called fromfile:/F:/Sites/ccpd-dev/plugins/lessengine/lib/lesscss-engine-1.3.0.jar!/META-INF/less.js: line 470
called fromfile:/F:/Sites/ccpd-dev/plugins/lessengine/lib/lesscss-engine-1.3.0.jar!/META-INF/engine.js: line 35
If I try to compile a less file that is in a jar, i get an IOException:
java.io.IOException: No such file jar:file:/path/to/jar/file.jar!/path/to/file.less
getClassLoader().getResource() is finding the file in the classpath, but the jar file path format causes the UnixNewlinesResourceLoader to choke.
I created a fork that has a failing unit test if that helps:
lkobashigawa@088aaf6
Hi team,
I'm facing with a problem which relate to relative path in an imported less, I'll show my case in the commit ndkhoiits@4e10c3d
The problem is demonstrated as following:
I have a less file at root folder named main.less
, a file in inc
folder named imported.less
, and a list of images in background
folder subfolder of inc
|─── main.less
|─── inc
| |──── imported.less
| |──── background
Now, in imported.less, I have a style like that:
.profile {
float: left;
background-image: url('background/image.png');
}
and the main.less
@import "inc/imported.less";
Now, my output expectation is :
.profile {
float: left;
background-image: url('inc/background/image.png');
}
Hi,
My usage of lesscss is the next one :
First of all : is there a best practice to do that ?
My problem is that I use the @import directive in the "css less file" to include my "variables less file" and so ... the imported file is always the same (ie the same path), so I need to change my "variables less file" (copy / paste overwrite) with the one I need each time.
I need to automate the generation.
Is there a way to specify the path (maybe in com.asual.lesscss.LessOptions ?) like it is possible with the client side version ? (http://lesscss.org/ paragraph "Configuration" : "Specify search paths for @import directives")
Thanks,
I know you've pretty much moved on, but wanted to see if maybe anyone else resolved this issue.
When source maps are turned on, I can't get imports working properly (it works if there's only variables).
for the sake of code maintenance I've placed all of the bootstrap less files in a subfolder named bootstrap and I am trying to @import it from the parent folder, like so:
@import "bootstrap/bootstrap.less";
but I get an error
com.asual.lesscss.LessException: Syntax Error: java.lang.IllegalArgumentException: protocol = http host = null (line -1, column -1) near at com.asual.lesscss.LessEngine.parseLessException(LessEngine.java:215):215 at com.asual.lesscss.LessEngine.compile(LessEngine.java:162):162 at com.asual.lesscss.LessEngine.compile(LessEngine.java:172):172 ...
if I specify the absolute path it works ok.
it looks like the default protocol for import is http and not file. is that the expected behavior? how can I specify a relative path in the @import ?
thank you.
For files a.less:
@import b.less;
.bar {
.foo;
font-size: 15px;
}
and b.less:
.foo {
background: green;
}
lesscss-engine compiles a.less to the following css:
.bar {
background: green;
font-size: 15px;
}
rather than:
.foo {
background: green;
}
.bar {
background: green;
font-size: 15px;
}
This is a regression and was not the case in 1.3.3.
I encountered this exception after upgrading from 1.3.0 (where imports didn't work), to 1.5.1.
[main] DEBUG com.asual.lesscss.LessEngine - Initializing LESS Engine.
[main] DEBUG com.asual.lesscss.compiler.RhinoCompiler - Using implementation version: Rhino 1.6 release 7 2007 08 19
[main] ERROR com.asual.lesscss.LessEngine - LESS Engine intialization failed.
org.mozilla.javascript.EcmaError: TypeError: Cannot find function bind. (file:/C:/Users/pcummuskey/.m2/repository/com/asual/lesscss/lesscss-engine/1.5.1/lesscss-engine-1.5.1.jar!/META-INF/source-map.js#152)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3350)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3340)
at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3356)
at org.mozilla.javascript.ScriptRuntime.typeError1(ScriptRuntime.java:3368)
at org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3428)
at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2052)
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3081)
at script(file:/C:/Users/pcummuskey/.m2/repository/com/asual/lesscss/lesscss-engine/1.5.1/lesscss-engine-1.5.1.jar!/META-INF/source-map.js:152)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2394)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:173)
at org.mozilla.javascript.Context.evaluateReader(Context.java:1227)
at com.asual.lesscss.compiler.RhinoCompiler.<init>(RhinoCompiler.java:32)
at com.asual.lesscss.LessEngine.<init>(LessEngine.java:84)
at com.asual.lesscss.LessEngine.<init>(LessEngine.java:58)
at com.asual.lesscss.LessEngine.<init>(LessEngine.java:54)
Hi,
Is the latest version of less.js included with the lesscss engine? I am trying to use the engine in a project but am getting a single compile error when compiling the bootstrap less files.
Thanks,
James
If I attempt to use an Escaped String in lesscss-servlet (v1.0.43) it produces a "com.asual.lesscss.LessException: Parse Error: Syntax Error".
The example less code I am attempting to compile is...
.gradient (@from, @to) {
background-color: @from + ((@to - @from) / 2);
background-image: -webkit-gradient(linear, left top, left bottom, from(@from), to(@to)); /* Saf4+, Chrome */
background-image: -webkit-linear-gradient(top, @from, @to); /* Chrome 10+, Saf5.1+ */
background-image: -moz-linear-gradient(top, @from, @to); /* FF3.6 */
background-image: -ms-linear-gradient(top, @from, @to); /* IE10 */
background-image: -o-linear-gradient(top, @from, @to); /* Opera 11.10+ */
background-image: linear-gradient(top, @from, @to);
filter: ~"progid:DXImageTransform.Microsoft.gradient(startColorStr='@{from}', EndColorStr='@{to}');" /* IE6–IE9 */
}
In the current implementation of the less engine, the charset is set to UTF-8 for the file compilation, and it can't be changed.
The LessEngine should let the user defines the charset to use.
del
I got an exception compiling LESS that works fine with 1.5.1. Looks like the ampersand operator support got lost?
com.asual.lesscss.LessException: com.asual.lesscss.LessException: Parse Error: Unrecognised input (line 2, column 1) near
.modulePage {
&.course-pf {
background-color: @body-bg !important;
at com.asual.lesscss.compiler.NashornCompiler.compile(NashornCompiler.java:79)
We're embedding LESS engine in our web server that is using Rhino 1.7 and I suspect that this is causing an issue with the parseLessException method. An exception is being thrown from line 156 which appears to be a result of the call to get the "message" property from the root exception value.
We were previously using 1.3.0 and it looks like you've added the .toString() calls in 1.5.0 but this doesn't appear to be fixing the problem.
This is a real shame because it would be really nice to see the action LESS error (at the moment we just catch the ClassCastException knowing that there is a LESS compilation problem somewhere but not knowing the actual details.
See stack trace below:
16:43:29,634 ERROR [extensions.surf.LessForJavaCssThemeHandler] LESS for Java Engine error compiling: 'js/alfresco/search/css/FacetFilter.css': java.lang.ClassCastException: org.mozilla.javascript.ConsString cannot be cast to java.lang.String
at com.asual.lesscss.LessEngine.parseLessException(LessEngine.java:156)
at com.asual.lesscss.LessEngine.compile(LessEngine.java:93)
at com.asual.lesscss.LessEngine.compile(LessEngine.java:83)
Will cause NullPointerException when working with latest Rhino build:
java.lang.NullPointerException
at com.asual.lesscss.LessEngine.parseLessException(LessEngine.java:173)
at com.asual.lesscss.LessEngine.compile(LessEngine.java:114)
there seems to be an issue with being able to turn on relative pathing for resources. Is this functionality not available? In the js, I can call relativeUrls: true.
Using version 1.0.41, I get escaped newline chars in the output...
css = lessEngine.compile(MyClass.class.getResource("/test.less"));
// FIXME: Why is the returned string JS-escaped?!?
css = css.replace("\\n", "\n");
Also, the example in README.md is misleading. The returned value is the compiled CSS text, NOT a url...
// Compiles an URL resource
String css = engine.compile(getClass().getClassLoader().getResource("META-INF/test.less"));
I'm using jboss to run web app,
this library throws this exception:
Caused by: com.asual.lesscss.LessException: java.net.MalformedURLException: unknown protocol: jndi
at com.asual.lesscss.LessEngine.parseLessException(LessEngine.java:252)
at com.asual.lesscss.LessEngine.compile(LessEngine.java:180)
at com.asual.lesscss.LessEngine.compile(LessEngine.java:165)
at com.my.system.frontend.LessCssGen.generateCssFromLess(LessCssGen.java:49)
Hi,
I'm using the less plugin for the play framework, which has lesscss-engine-1.0.43.jar as a dependency. This version translates, e.g., the code "@var: 4px; div { width: -@var; }" to "div { width: - 4px; }" which seems to be invalid less code (there should be no space between the minus sign and the number).
A new HTTPSResourceLoader (copy of HTTPResourceLoader) could be added to the resource loader chain to allow loading resources via HTTPS. Things like:
@import "https://....less";
do not work right now.
On Windows, StreamResourceLoader.java
throws an exception in two places where it shouldn't.
Assume we're calling this code from the subclass FilesystemResourceLoader
.
In the code below, assume path
exists on disk and has every permission imaginable granted.
If path
looks like C:\folder\file.less
, then the Matcher m
will match; group(1)
will be C
and thus be treated as the schema
of the path
. The function will then recurse with path
being \folder\file.less
. Herein lies the problem.
Locally, I overrode the implementation of exists(path)
and load(path)
in FilesystemResourceLoader
. However, it's not the cleanest implementation. I marked my changes below as inline comments.
@Override
public boolean exists(String path) throws IOException {
Matcher m = PATTERN.matcher(path);
if (m.matches()) {
if (m.group(1).equals(getSchema())) {
return exists(m.group(2));
}
return false; // I commented out this line of code
}
InputStream stream = openStream(path);
if (stream != null) {
stream.close();
return true;
}
return false;
}
@Override
public String load(String path, String charset) throws IOException {
Matcher m = PATTERN.matcher(path);
if (m.matches()) {
if (m.group(1).equals(getSchema())) {
return load(m.group(2), charset);
}
throw new IOException("No such file " + path); // I also commented out this line of code
}
InputStream is = openStream(path);
if (is != null) {
return readStream(is, charset);
}
throw new IOException("No such file " + path);
}
Escaping expressions is currently not possible and leads to errors when using gradient functions like the one escaped here:
http://lesscss.org/#-escaping
Since LessEngine now includes a main function (see 89ac9bb), could pre-packaged JAR files be posted in the project’s “Download” section?
I’d like to integrate LessCSS into my (non-Java/non-ant) project’s build process. Having a pre-packaged JAR file that I can download, run, and integrate really makes things easier.
Thanks!
java -classpath /usr/share/java/commons-logging.jar:/usr/share/java/commons-cli.jar:/usr/share/java/lesscss-engine.jar:/usr/share/java/rhino.jar com.asual.lesscss.LessEngineCli spacewalk.less
Exception in thread "main" java.lang.IllegalArgumentException: opt contains illegal character value '-'
at org.apache.commons.cli.OptionValidator.validateOption(OptionValidator.java:73)
at org.apache.commons.cli.Option.<init>(Option.java:123)
at org.apache.commons.cli.Options.addOption(Options.java:131)
at org.apache.commons.cli.Options.addOption(Options.java:114)
at com.asual.lesscss.LessEngineCli.main(LessEngineCli.java:49)
It works if all options defined in LessOptions.java that contains '-' are camelcased.
First, thanks a lot for this great work. I have been using some of this code for a little utility I wrote (jcruncher) and my Snow framework. Now, I would love to use the library (rather than the code). Any update for the 1.4.2 final?
This has the effect that you have to remember to modify the importing css too everytime you make a change.
Any chance of including a minify option to compress the css?
The first example on lesscss.org failed with lesscss-engine master branch due to new method iscolor introduced in last lesscss release.
After replace /src/main/resources/META-INF/less.js with latest[1], the test failed with:
org.mozilla.javascript.EcmaError: ReferenceError: "window" is not defined.
Would be great if lesscss-engine could just work without modify the original less.js.
Thanks!
[1]https://raw.github.com/cloudhead/less.js/master/dist/less-1.2.1.js
When compiling less source from a String, @import
statements don't work, presumably because the @import
statements are interpreted relative to the location of the source file.
It would be helpful if there was a compile
method that could take a String
and a root file path and use the root file path as the root for paths in @import
statements.
The reason for wanting this is to allow less to be used for scripting CSS within a web template engine. The less code does exist in the filespace but is only part of a file, not a whole file, so I need to pass the content as a String.
I have tried saving the String as a temporary file and then using the compile
method that takes a file. However, when I use an absolute file reference for my @import
I find that the absolute reference has been concatenated to the end of the directory containing the temporary file. In other words, it appears that the underlying less.js
code may only be able to cope with relative paths.
less.js 1.5.0 will have support for source map generation. It's already implemented, just waiting for the next release.
I am trying to work with this library in a Grails project but just running the example code
LessEngine engine = new LessEngine();
String text = engine.compile("div { width: 1 }");
throws the exception
com.asual.lesscss.LessException: Syntax Error: Cannot find function trim.
The version I am working on is 1.4.2.
It seems to be working with version 1.3.3.
is it possible to create Java8 nashorn version of this library?
It's possible use less-1.4.x.js instead of actual (1.3.x)?
I'm trying to integrate LESS with JAWR 3.3 (using a modified version of eliotsykes/less-css-jawr). JAWR configuration uses servlet-relative paths, which are then passed to ServletContext.getResource() to get a jndi:// URL, which I pass to engine.compile(). When LessEngine gets the jndi URL, no ResourceLoader handles it.
I have a working patch that is just a copy/paste of HTTPResourceLoader with a different schema.
It would be great to be able to pass in the location of the less.js file
a) future versions of less.js can be used even without updating this lesscss-engine lib
b) I'm writing a maven plugin which does not need to be updated every time a new version of less.js will be released.
In the Maven plugin I will allow the users to specify the location of less.js.
Most users will have less.js to be included in webapp/js anyway to use the less.js directly in development mode.
Please let me know if you would consider this approach otherwise I might need to seek other alternatives, like writing my own engine by e.g. forking this project.
Cheers,
Marcel
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.