Last modified: 2014-03-06 02:28:17 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 T64300, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 62300 - MediaWiki LESS files are incompatible with lessc
MediaWiki LESS files are incompatible with lessc
Status: NEW
Product: MediaWiki
Classification: Unclassified
Interface (Other open bugs)
1.23.0
All All
: Lowest enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-03-06 02:17 UTC by spage
Modified: 2014-03-06 02:28 UTC (History)
5 users (show)

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


Attachments

Description spage 2014-03-06 02:17:35 UTC
I tried to compile vector.less using lessc 1.4.2 (LESS Compiler) [JavaScript]:

$ lessc --include-path=/home/spage/projects/core/resources/mediawiki.less/ resources/mediawiki.ui/vector.less

fails with

FileError: 'mediawiki.mixins' wasn't found in .../resources/mediawiki.ui/components/default/buttons.less on line 1, column 1:
1 @import "mediawiki.mixins";

It seems lessc requires you include the extension when importing files from the include path.  If I change the line in buttons.less to
  @import "mediawiki.mixins.less"

then lessc fails with
ParseError: Unrecognised input in .../resources/mediawiki.less/mediawiki.mixins.less on line 15, column 18:

15 	background-image: url(@url)!ie;

lessc doesn't like the !ie.  We actually use this in e.g. mediawiki.action.view.postEdit.  Maybe it needs to be quoted or escaped in some way.

Our PHP compiler in includes/lib/lessc.inc.php is obviously different code than the nodejs implementation, but we should avoid gratuitous incompatibilities.

An alternative to using lessc is to use ResourceLoader to generate the CSS, e.g.
http://en.wikipedia.org/w/load.php?debug=true&lang=en&modules=mediawiki.ui&only=styles&skin=vector&* , and save the resulting file.
Comment 1 Krinkle 2014-03-06 02:25:08 UTC
Two reasons this fails:


1) Configuration

You're comparing a run of php-lessc having configuration with node-lessc having no configuration. See documentation for lessc for how to set e.g. import path.

2) Hooks

Lessc is a dynamic parser that allows variables and hook functions to be registered. This is the case both in the node as well as the php implementation. However as these variables and hook functions are declared in the backend language (not in less syntax itself) they will inherently not be usable by other interpreters.
Comment 2 Krinkle 2014-03-06 02:28:17 UTC
Classifying as low priority enhancement (not a bug) as there should be no expectation that running it on another parser would work or what the use case of that would be.

There are other incompatibilities besides the inability for another language to interpret the variables and hook functions, but those are upstream features / bugs in the php or js implementation.

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


Navigation
Links