Textpattern Forum

You are not logged in. Register | Login | Help

#151 2011-12-20 18:15:00

mrdale
Moderator
From: Walla Walla
Registered: 2004-11-19
Posts: 2,050
Website

Re: rvm_css (v1.0)

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,396

Re: rvm_css (v1.0)

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

ruud
Developer emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 4,492
Website

Re: rvm_css (v1.0)

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,396

Re: rvm_css (v1.0)

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

ruud
Developer emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 4,492
Website

Re: rvm_css (v1.0)

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,396

Re: rvm_css (v1.0)

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

ruud
Developer emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 4,492
Website

Re: rvm_css (v1.0)

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,396

Re: rvm_css (v1.0)

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

ruud
Developer emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 4,492
Website

Re: rvm_css (v1.0)

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,396

Re: rvm_css (v1.0)

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

Board footer

Powered by FluxBB