Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#145 2011-12-20 16:11:28

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: rvm_css (v1.2)

Joe, please try the plugin version I just uploaded (0.9) and let me know if that solves the problem.
Just tried it myself. Seems to work, although you must import using absolute paths.

Offline

#146 2011-12-20 16:38:46

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: rvm_css (v1.2)

Ruud> Just wanted to say thanks again for less support (pun intended).

Can you see any way to bend that library to allow comments to get through? My site editing workflow is basically to make css edits with live preview using “edit-css” with Chris Pederick’s “Web Developer” firefox plugin. Then copy/paste to TXPs Style page. Preserving comments is not possible with that little round trip.

Offline

#147 2011-12-20 16:51:30

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,726
Website

Re: rvm_css (v1.2)

My site editing workflow is basically to make css edits with live preview using “edit-css” with Chris Pederick’s “Web Developer” firefox plugin. Then copy/paste to TXPs Style page. Preserving comments is not possible with that little round trip.

I do something similar with CSSedit (now Espresso 2) and you can work with comments without any problems, plus its not as fragile as working with the webdev plugin (got fed up with losing my work after inadvertently refreshing).

How do you integrate using LESS into that workflow? I’m not such a CSS guru that I can write error-free css onto a blank document – I need to see the page from time to time. Or does less.js allow you to edit your less code and see a live preview at the same time?


TXP Builders – finely-crafted code, design and txp

Offline

#148 2011-12-20 16:51:51

joebaich
Member
From: DC Metro Area and elsewhere
Registered: 2006-09-24
Posts: 507
Website

Re: rvm_css (v1.2)

It seem to work Ruud. the ‘Import’ files get processed. However, on my trial site I am not getting the results I expected and will have to investigate. It may be an error in one of the LESS files I dragged across. I’ll get back to you.

Added later It looks as though less.php does not emulate LESS.js exactly. In this instance the example CSS statements produced by LESS.js are expressed as a value in percent (56.7%) as intended. The same lines processed by less.php renders the same number in pixels (56.7px). I think that the revised plug-in is doing it’s thing correctly and that less.php needs some work so that it behaves in the same way as LESS.js.

Even later The problem with expressing calculated width values in pixels when they are intended to be expressed in percentages is a documented less.php issue and there is no indicationI could find that it is being addressed, though it may well be. I hope that it won’t always be a case of less.php running to catch up with LESS.js and never getting close enough.

Last edited by joebaich (2011-12-20 23:29:35)

Offline

#149 2011-12-20 17:20:07

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: rvm_css (v1.2)

Version 0.8.2 uploaded (only Dale downloaded the 0.9 version), which automatically translates @import ‘something.less’; into the correct absolute file path. And if parsing the LESS code fails, it doesn’t update the .css file and shows an error at the bottom of the admin side CSS page.

Dale, 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.

Offline

#150 2011-12-20 17:33:22

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,634
GitHub Twitter

Re: rvm_css (v1.2)

ruud wrote:

LESS support added in version 0.8. It does require you to install the less.inc.php file manually (unless someone puts it into a separate plugin. rvm_css simply checks if the lessc class exists and uses it if it does), which makes it easier to keep that file up-to-date without me having to keep track of updates (because I don’t use LESS myself).

Yeah Man. absolutely fabulous!

Ruud is the Santa Claus of all TXP users :)

I’m going to try this.

Cheers,


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

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

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

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

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

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

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

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

Board footer

Powered by FluxBB