Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#151 2011-12-20 18:15:00
Re: rvm_css (v1.2)
ruud wrote: I don’t want to fork the lessphp library, so if preserving comments is important, ask the person who develops the library to provide a solution.
well fork you… ;) I did pose the question to their forum, so perhaps there’ll be a config variable that we can set at some further point.
Thanks again.
Offline
#152 2012-04-01 18:46:34
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: rvm_css (v1.2)
Hi Ruud,
I love this plugin and I appreciate you decided to include LESS support.
Anyway I have some issues with LESS imports. (I’m testing the plugin in a local install using xampp on windows).
If I write In my default.less this:
@import "colors.less";
the output in the css file is:
@import url("C:\xampp\htdocs\txp3/css/colors.less");
As you can see there are two order of issues
1) slashes are not correct. Maybe using the DS constant may be of help?
2) the output is not what I expected. The rule is treated as if it was a normal css import even if the referenced file has a .less extension. Of course this line should not even be there in the compiled css file. Needless to say the contents of the file I’m trying to import are completely ignored.
I hope I’m not missing something obvious here and I thank you in advance for any help you could provide.
P.S. Apart from the import issue everything else is working perfectly.
Offline
#153 2012-04-02 14:59:24
Re: rvm_css (v1.2)
Hmm… try changing this:
$css = preg_replace('/@import\s[\'"]([^\/]+?\.less)[\'"];/', '@import "'.$path_to_site.'/'.$rvm_css_dir.'/$1";', $css);
into:
$css = preg_replace('/@import\s[\'"]([^\/\\\\]+?\.less)[\'"];/', '@import "'.$path_to_site.DS.$rvm_css_dir.DS.'$1";', $css);
Does that fix the import line?
As for #2, could be because if the slashes issue in the import statement. If not, did you import the less library from your config.php file?
[fixed two errors]
Last edited by ruud (2012-04-03 17:38:40)
Offline
#154 2012-04-03 16:51:48
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: rvm_css (v1.2)
Er… I think this issue is not so easily solvable, at least for me.
The problem seems to be with backslashes interfering with regular expressions (which of course are a total mistery to me).
For the record I’ve tried all sorts of variations of line 96 and I even managed to output the correct path in my local windows install, but this won’t work either.
At the end I gave up.
All in all the most important thing is that the plugin is working on a live environment. For local development I’ll use simpLESS which I think is a good compromise.
Thanks Ruud and Bloke for the help!
Offline
#155 2012-04-03 17:41:13
Re: rvm_css (v1.2)
Try again. I edited my earlier post. Apparently, you need to use \\\\ if you want to match a single backslash in PCRE.
Offline
#156 2012-04-03 20:47:04
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: rvm_css (v1.2)
Ok Ruud, thanks again for the help.
Sadly this won’t work either, now that’s what I get in my compiled css (I’m using xampplite in an old notebook now but this shouldn’t make a big difference):
@import url("C:\xampplite\htdocs\txp3\css$1");
Furthermore I have this error upon saving the css in the ‘style’ tab:
Warning: substr_compare() [function.substr-compare]: The start position cannot exceed initial string length in C:\xampplite\htdocs\txp3\lessc.inc.php on line 233
Which is clearly an issue with the lessc.inc.php file.
As always – apart from the import issue and the error shown above – everything else is working ok.
P.S. Ruud, I think you are probably not a windows user (I have to use it at work but I prefer linux at home) so I feel your pain. Really, I appreciate your help but don’t kill yourself on this, ok?
Last edited by redbot (2012-04-03 20:56:15)
Offline
#157 2012-04-07 17:08:13
Re: rvm_css (v1.2)
I suspect you’ve made a typo. I’ve released version 0.9 which should fix the “less” import issues on Windows hosting. (and you’re right. I only use Windows at work. Linux at home).
Offline
#158 2012-04-07 17:23:54
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: rvm_css (v1.2)
ruud wrote:
I suspect you’ve made a typo. I’ve released version 0.9 which should fix the “less” import issues on Windows hosting.
Hi Ruud,
I hope someone else who is testing the plugin in a windows+xampp local install could tell if the plugin works for them. I’m sorry but I continue to have the same output shown before
@import url("C:\xampplite\htdocs\txp3\css$1");
Anyway the error message is gone.
Thank you again for the help.
Last edited by redbot (2012-04-07 17:24:28)
Offline
#159 2012-04-08 13:36:12
Re: rvm_css (v1.2)
Okay, I’ve been able to reproduce the issue and this time I think I’ve fixed it. I mean it. Really!
New version available for download (0.9.1)
Offline
#160 2012-04-22 16:31:47
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: rvm_css (v1.2)
Hi again Ruud,
first of all excuse me for responding so late, I’ve been away from home for the last two weeks.
I have tested the updated plugin and I have a good and a bad news.
The good news is now the plugin outputs the correct path. The bad one (I know, you are gonna hate me now) is that there are still issues.
An example will hopefully clarify what I mean:
Suppose you have created two styles in the ‘style’ tab: default.less and colors.less
‘colors’ file contains this code:
@color: #00ff00;
and the ‘default’ file contains these rules:
@import "colors.less";
#some_id {color: @color;}
Now if you look at the parsed default.css file you see exactly this:
@import url("C:\xampp\htdocs\txp3\css\colors.less");
#some_id { color:; }
But – even if the path is now correct – this isn’t what i shoud see, right? I would expect this:
#some_id { color:#00ff00; }
In other words the @import part shouldn’t be there at all and furthermore the imported styles are not parsed.
I can confirm this only happens in my local xampp intallation, everything works ok in a remote server.
Offline
#161 2012-04-22 17:04:21
Re: rvm_css (v1.2)
Hmm… that’s not cause by the plugin, I think, but by the lessphp parser. Are you using the most recent version. I see a lot of new versions appearing here lately and version 0.3.2 has some windows fixes.
Offline
#162 2012-04-23 10:24:49
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: rvm_css (v1.2)
ruud wrote:
…Are you using the most recent version. I see a lot of new versions appearing here lately and version 0.3.2 has some windows fixes.
Hi Ruud,
yes I’m using the latest version 0.3.4-2.
I’ll try to investigate further h (with my very limited programming skills).
BTW can someone else reproduce this issue?
P.S.
Thanks for all the support.
Offline
#163 2012-04-23 13:00:29
Re: rvm_css (v1.2)
What happens if you put this in your CSS (first create colors1.less … colors10.less in your css dir):
@import 'C:\xampp\htdocs\txp3\css\colors1.less'
@import "C:\xampp\htdocs\txp3\css\colors2.less"
@import url('C:\xampp\htdocs\txp3\css\colors3.less');
@import url("C:\xampp\htdocs\txp3\css\colors4.less");
@import 'C:/xampp/htdocs/txp3/css/colors5.less'
@import "C:/xampp/htdocs/txp3/css/colors6.less"
@import url('C:/xampp/htdocs/txp3/css/colors7.less');
@import url("C:/xampp/htdocs/txp3/css/colors8.less");
@import "C:\xampp\htdocs\txp3/css/colors9.less");
@import "C:\xampp\htdocs\txp3\css\/colors10.less");
I can’t test it myself because don’t have access to a Windows computer with PHP installed.
Offline
#164 2012-04-27 16:17:41
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: rvm_css (v1.2)
ruud wrote:
What happens if you put this in your CSS…
Hi Ruud,
if I just copy/paste your code I got:
@import url("C:\xampp\htdocs\txp3\css\colors1.less") @import "C:\xampp\htdocs\txp3\css\colors2.less"
@import url('C:\xampp\htdocs\txp3\css\colors3.less');
@import url("C:\xampp\htdocs\txp3\css\colors4.less");
@import url("C:/xampp/htdocs/txp3/css/colors5.less") @import "C:/xampp/htdocs/txp3/css/colors6.less"
@import url('C:/xampp/htdocs/txp3/css/colors7.less');
@import url("C:/xampp/htdocs/txp3/css/colors8.less");
@import url("C:\xampp\htdocs\txp3/css/colors9.less") );
@import url("C:\xampp\htdocs\txp3\css\/colors10.less") );
#some_id { color:; }
I don’t know if you omitted by purpose the ending semicolon in some lines. Anyway here is what I got if I add them:
@import url("C:\xampp\htdocs\txp3\css\colors1.less");
@import url("C:\xampp\htdocs\txp3\css\colors2.less");
@import url("C:\xampp\htdocs\txp3\css\colors3.less");
@import url("C:\xampp\htdocs\txp3\css\colors4.less");
@import url("C:/xampp/htdocs/txp3/css/colors5.less");
@import url("C:/xampp/htdocs/txp3/css/colors6.less");
@import url("C:/xampp/htdocs/txp3/css/colors7.less");
@import url("C:/xampp/htdocs/txp3/css/colors8.less");
@import url("C:\xampp\htdocs\txp3/css/colors9.less") );
@import url("C:\xampp\htdocs\txp3\css\/colors10.less") );
#some_id { color:; }
Offline
#165 2013-02-27 16:54:22
Re: rvm_css (v1.2)
ruud wrote:
I think the benefits of minifying don’t outweigh the added code complexity (especially if you’re already compressing CSS using deflate/gzip). It reduces bandwidth usage, but I suspect that on most websites the bandwidth used by serving CSS files is only a few percent of total bandwidth used.
Ruud,
You can add a single line of code to your plugin to add minification to the CSS output… I’ve been using it without flaw for a long time now. Here’s the example documentation from LessPHP: http://leafo.net/lessphp/docs/#output_formatting
Here’s how I modified the plugin to output minified CSS:
Replace this line:
$less = new lessc();
With this:
$less = new lessc();
$less->setFormatter("compressed");
Works like a charm.
Again, thanks for an amazing plugin!
Last edited by qrayg (2013-02-27 17:04:46)
Offline