Last modified: 2014-03-07 23:55:14 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T42964, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 40964 - Implement support for LESS pre-processor in ResourceLoader
Implement support for LESS pre-processor in ResourceLoader
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
ResourceLoader (Other open bugs)
1.21.x
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on: 46546
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-11 17:40 UTC by Jon
Modified: 2014-03-07 23:55 UTC (History)
10 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Jon 2012-10-11 17:40:35 UTC
The mobile team is currently using lesscss [1] to maintain CSS. Without less things were quickly becoming messy.

Currently as part of the workflow a Makefile [2] is used to generate less files to css and both CSS and Less files need to be committed to the repository.

It would be awesome if less files could be added directly into ResourceLoader and ResourceLoader could do the compiling on my behalf.

It seems there is a php port [3] so this seems feasible. Thoughts?

[1] http://lesscss.org/
[2] https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/MobileFrontend.git;a=blob;f=Makefile;h=a6787d2c1ecaf4eaf0304c7e8197db782a3d7dac;hb=HEAD
[3] http://leafo.net/lessphp/
Comment 1 Krinkle 2012-10-11 18:09:13 UTC
This was proposed before, however (though I can't find the bug at the moment) there were two reasons to not implement it:

* (blocking)

The LESS compiler was too slow to be usable for ResourceLoader. One of the greatest strengths of ResourceLoader is that there is no "build" or "make" process. Instead resources are put through the post-processor(s) and packagers on-demand in the cache miss response. It has very strong caching, so misses are rare. But when it does miss, we need to be able to generate the response in reasonable time (that is < 1 second for all N files).

* (non-blocking, but depending)

Our current debug mode loads files raw from disk. There is currently (for debug, among other reasons) the paradigm that the post-processor only enhances scripts/styles, never as a requirement for it to be functional. So in the current way of things, any pre-processor wouldn't be an option. 

* (trivial)

There were some voices regarding treatment towards others popular CSS libraries besides LESS (Sass, SCSS, Compass, Bless, ..) etc.


See also the "Caching" and "Notes" section on https://www.mediawiki.org/wiki/ResourceLoader/Features.
Comment 2 Ori Livneh 2012-10-30 13:18:39 UTC
lessphp seems to perform rather well. I ran it against several files in the MobileFrontend extension: here's a representative example, mf-settings.less, which is 184 lines / 3097 bytes:

    $ time { ~/wiki/lessphp/plessc mf-settings.less &>/dev/null ; }

    real	0m0.068s
    user	0m0.056s
    sys	0m0.009s
Comment 3 spage 2013-03-25 19:00:10 UTC
FYI we are building the new Agora CSS styles (mw-ui-button, mw-ui-formlist) using Compass. For now the scss source files are in the Agora extension; like Jon we have a Makefile to compile to CSS and commit the results to the repository.

Running make which invokes compass which uses Ruby is pretty slow.
real	0m0.378s
user	0m0.340s
sys	0m0.024s

for 377 lines in 16 sccs files, and twice a long if there's no .sass-cache.
Comment 4 Matthew Flaschen 2013-03-30 04:09:20 UTC
I've suggested this as a possible Google Summer of Code project: https://www.mediawiki.org/wiki/Mentorship_programs/Possible_projects#SASS.2FLESS
Comment 5 MZMcBride 2013-08-12 03:14:19 UTC
Related: https://gerrit.wikimedia.org/r/78669
Comment 6 MZMcBride 2013-08-12 03:17:44 UTC
Do we want MediaWiki to support both LESS and SASS/Compass? They seem to fill the same niche, so I'm not sure supporting both in MediaWiki core makes sense. I'm not sure the cost of doubling the code complexity (i.e., supporting both) is worth the benefit, but I'd be interested in what others think.

(Punting and putting both in MediaWiki extensions rather than in MediaWiki core could be an option.)
Comment 7 Ori Livneh 2013-08-12 03:42:07 UTC
(In reply to comment #6)
> Do we want MediaWiki to support both LESS and SASS/Compass? They seem to fill
> the same niche, so I'm not sure supporting both in MediaWiki core makes
> sense.

We don't support SASS. We compile SASS by hand and commit both the generated CSS and original SASS source into core. Ditto LESS.

We don't want to continue using two CSS preprocessor languages; that'd be silly. If my patch is merged, we'd settle on LESS, and convert our existing SASS code. 

Why LESS and not SASS? Simply because its PHP implementation is decidedly more robust and has a good track record of active development.
Comment 8 MZMcBride 2013-08-12 03:47:50 UTC
(In reply to comment #7)
> We don't support SASS. We compile SASS by hand and commit both the generated
> CSS and original SASS source into core. Ditto LESS.

Sorry, I was viewing this bug in the context of (the arguably competing) bug 46545. I should have made that clearer in my comment. My view currently is that only this bug or bug 46545 should be resolved/fixed (in MediaWiki core), which I think from reading your comment, you agree with.
Comment 9 Ori Livneh 2013-08-20 02:20:29 UTC
Support in core is now under discussion at this MediaWiki RFC:
http://www.mediawiki.org/wiki/Requests_for_comment/LESS


(In reply to comment #8)
> My view currently is that only this bug or bug 46545 should be resolved/fixed
> (in MediaWiki core), which I think from reading your comment, you agree with.

Yep.
Comment 10 Gerrit Notification Bot 2013-09-14 04:23:35 UTC
Change 78669 had a related patch set uploaded by Ori.livneh:
Support LESS stylesheets in ResourceLoader

https://gerrit.wikimedia.org/r/78669
Comment 11 Gerrit Notification Bot 2013-09-23 19:59:51 UTC
Change 78669 merged by Brion VIBBER:
Support LESS stylesheets in ResourceLoader

https://gerrit.wikimedia.org/r/78669

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links