-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JavaScript Evaluation #22
Comments
Postponed since may deprecate it in the future. This will be implemented only if they will decide that they do want it. |
Removed javascript tests from less.js 1.3.3 test suit. It needs to be added back before closing this issue. |
Escaping in JavaScript is also supported:
Found in twitter bootstrap v2.1.1 #127 |
We have a need for javascript evaluation in backticks. I could look into implementing this. If you have a moment, would you be able to do a brain dump of thoughts about implementing it? Where things will need to be added etc. Does ` need to be added to the grammar? |
Hi, that would be really awesome. Braindump has two parts, one is about API and another explains less4j code. This comment has only API part in it, less4j architecture will go into second comment. API: So, maybe we could do it plugginable? The new If the compiler would be unavailable, less4j would issue warning/error and leave expression unchanged. Advantages:
I do not mind publishing that into maven or maintaining that other repo, if you do not want to bother with bureaucracy. |
Less4j uses ANTLR. If you never used it, here are tutorials:
The grammar file:
The general overwiew of how less4j works is explained here. You do not have to read the whole post, only the chapter I linked. JavaScript expressions could be parsed and evaluated as other expressions, e.g. almost like functions. Advantage: they would be automatically allowed everywhere where expressions goes (variable values, selectors, functions, properties.) Plus, they are expressions. You have to:
You can look at how functions are done, it should be almost the same. Unit tests:
Good luck :) |
This is going to be possible using custom functions https://github.com/SomMeri/less4j/wiki/Extending-Less-Language which are already implemented, but do not support ~ Starting with next release:
The advantage is that anyone will be able to implement them however he likes and use any language he finds useful. I'm not sure whether or when I will create "official" javascript implementation, but anyone will be able to do so. In any case, it will be stored in separate repository. I do not want less4j to depend on Rhino or other javascript runtime, because only some projects will use it. |
It might make sense to test lesshat compatibility #192 once custom javaascript function is released. |
corresponds to comma or space separated lists. ComposedExpression will now be used only for binary expressions.
This will have to wait until decisions for less/less.js#1939 , less/less.js#1941 and less/less.js#1943 are taken. I will do some javascript plugin, but it will be subject to changes later on. |
JavaScript plugin is here: https://github.com/SomMeri/less4j-javascript |
…, to allow different languages support.
…n which corresponds to comma or space separated lists. ComposedExpression will now be used only for binary expressions.
Known syntaxes:
The text was updated successfully, but these errors were encountered: