lunatech-labs / play-module-less Goto Github PK
View Code? Open in Web Editor NEWLess module for the Play framework
Less module for the Play framework
The less module output should be compressable and cachable by the Greenscript module.
I have an
// @import "blah.less";
the plugin tries to process that file even if is commented, and breaks trying to load that file.
I think the compiled less content should be stored in local cache, not in the global cache. Play use EnCache for local Cache. I think local cache could improve the performance .
Play started locking .less files when I started using less (it never locked anything before).
To reproduce, I believe this would work:
Hi
When I use press and less module together I obtain an Exception on file compression.
Oops: StringIndexOutOfBoundsException
An unexpected error occured caused by exception StringIndexOutOfBoundsException: String index out of range: 211
play.exceptions.UnexpectedException: Unexpected Error
at press.Compressor.writeCompressedFile(Compressor.java:352)
at press.Compressor.getCompressedFile(Compressor.java:323)
at press.Compressor.getCompressedFile(Compressor.java:291)
at press.JSCompressor.getCompressedFile(JSCompressor.java:32)
at controllers.press.Press.getCompressedJS(Press.java:25)
at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:548)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:502)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:478)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:473)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:161)
at Invocation.HTTP Request(Play!)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 211
at java.lang.String.substring(String.java:1934)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.printSourceString(JavaScriptCompressor.java:267)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:330)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.(JavaScriptCompressor.java:533)
at press.JSCompressor$1.compress(JSCompressor.java:46)
at press.Compressor.compress(Compressor.java:407)
at press.Compressor.writeCompressedFile(Compressor.java:345)
... 10 more
I understand that it is more a press bug, and I have open an issue on press module, but perhaps this is interesting for you.
Hi!
Could you please update the Less engine to version 1.3.1?
The new version fixes some anoying bugs.
Thanks a lot!
I have a simple test working with a less file here /public/stylesheets/test.less
It compiles and delivers css on request. However, twitter bootstrap.less does not. It returns empty.
My template:
link type="text/css" rel="stylesheet" media="screen" href="@{'/public/stylesheets/test.less'}"
link type="text/css" rel="stylesheet" media="screen" href="@{'/public/bootstrap/less/bootstrap.less'}"
The docs say that every .less file under /public/ will be compiled. So, I thought dropping the bootstrap folders in would work? No?
bootstrap 2.0.1
play-module-less 0.9
play 1.2.4
Suggestions?
My Dependencies file looks like so...
require:
- play -> less 0.3
However it doens't seem to compile my less files, where as adding it to application.conf does, though that method is deprecated.
Couldn't find anything declaring a license for this project. Under what license is this project released?
com.asual.lesscss.LessException: Parse Error: Syntax Error on line 31 (line 31, column 2) near
background-image: -ms-linear-gradient(top, #f4f4f4 0%, #eeeeee 48%, #f6f6f6 50%, #ffffff 80%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#ffffff',GradientType=0 );
background-image: linear-gradient(top, #f4f4f4 0%, #eeeeee 48%, #f6f6f6 50%, #ffffff 80%);
at com.asual.lesscss.LessEngine.parseLessException(LessEngine.java:185)
at com.asual.lesscss.LessEngine.compile(LessEngine.java:120)
at play.modules.less.PlayLessEngine.compile(PlayLessEngine.java:99)
at play.modules.less.PlayLessEngine.get(PlayLessEngine.java:43)
at play.modules.less.Plugin.handleOk(Plugin.java:61)
at play.modules.less.Plugin.handleResponse(Plugin.java:46)
at play.modules.less.Plugin.serveStatic(Plugin.java:28)
at play.plugins.PluginCollection.serveStatic(PluginCollection.java:641)
at play.server.PlayHandler.serveStatic(PlayHandler.java:849)
at Invocation.HTTP Request(Play!)
This looks like two problems actually...
Firstly, the browser re-GETs the *.less files for each page visits. That's unlike with plain *.css or *.js, where after the first visit, it doesn't even send a GET unless you hit Ctlr+R. My quick guess is that the cause of this behavior is that the response from the Less module contains this line:
Cache-Control: no-cache
Secondly, the CSS is always resent with HTTP 200 OK
instead of responding with HTTP 304 Not Modified
. So, I visit a pages for the 2nd time, and the client (Firefox) sends this:
GET /public/stylesheets/main.less HTTP/1.1
...
If-Modified-Since: Sun, 24 Jul 2011 12:57:57 GMT
If-None-Match: "1311512277400-946741085"
and Play answers with:
HTTP/1.1 200 OK
...
Etag: "1311512277400-946741085"
Last-Modified: Sun, 24 Jul 2011 12:57:57 GMT
The Etag and the timestamp are the same, yet it wasn't 304.
This was on Play 1.2.2, with the standard "play new" app with only Less 0.3 installed and main.css
is replaced with main.less
. I have tried it both in dev
and prod
mode. Used Firefox 5 + LiveHTTPHeaders + Firebug. Everything works fine with plain CSS.
I'm trying to use the less plugin with twitter bootstrap but I have this issue
(could be related to the less lib you use)
@gridGutterWidth: 20px;
.row {
.clearfix();
margin-left: -@gridGutterWidth;
}
this gets compiled into an invalid css, mind the space between the minus and the 20.
.row{
margin-left: - 20px;
...
}
Any suggestions on how to fix this?
The current version of the Less module does not compile the latest TwitterBootstrap v2.0 (https://github.com/twitter/bootstrap/tree/2.0-wip).
It throws the following exception :
com.asual.lesscss.LessException: Parse Error: Syntax Error on line 427 (line 427, column 4) near
&+.add-on {
*margin-left: -21px;
at com.asual.lesscss.LessEngine.parseLessException(LessEngine.java:182)
at com.asual.lesscss.LessEngine.compile(LessEngine.java:104)...
I tried with the latest lesscss-engine JAR (1.1.5), and it worked well.
Since TwitterBootstrap begins to be widely used, please update the lesscss-engine lib to the latest ;-)
Thanks,
Nico
See this issue: asual/lesscss-engine#23.
Please upgrade the lesscss engine.
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.