Last modified: 2014-09-20 21:11:13 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 T69368, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 67368 - (remove-custom-less) ResourceLoader: Remove custom LESS functions
(remove-custom-less)
ResourceLoader: Remove custom LESS functions
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
ResourceLoader (Other open bugs)
1.24rc
All All
: High normal (vote)
: 1.24.0 release
Assigned To: Bartosz Dziewoński
:
Depends on: 54673
Blocks:
  Show dependency treegraph
 
Reported: 2014-07-01 15:15 UTC by Krinkle
Modified: 2014-09-20 21:11 UTC (History)
7 users (show)

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


Attachments

Description Krinkle 2014-07-01 15:15:44 UTC
I think it was a design flaw that we went ahead with implementing php-land functions at all. It was a questionable experiment, but we know better now and I think we should admit that and phase it out ASAP.

This brings three main problems:

1) Decreased compatibility; (can't easily compile it with lessjs without porting the functions over and keeping in sync).
2) Extra maintenance; (when we switch lessphp implementations or upgrade, these will need updating).
3) Separation of concerns and flow control; (embedding is supposed to be part of CSSMin and run *after* CSSJanus; doing it in LESS before it even turns to CSS disrupts this).


Problem #3 causes bugs like bug 66091, where in Less files certain things don't get flipped properly by CSSJanus because it jumps the gun on mapping things to files on disk and reading them.

I think we should deprecate the less embed() function and instead ensure the /* @embed */. This provides many benefits:

* Reduced duplication.
* Less output is easier to debug with (no embedded data uris[1]).
* No maintenance overhead (and bugs like bug 66091) by having to keep its behaviour in sync with non-LESS files with regards to CSSJanus flipping.
* Keeps minification restricted to CSSMin (which runs anyway, the only way it makes sense to start minifying or reading files from disk earlier is if we somehow phase out CSSMin entirely, which would be an interesting adventure of its own)
Comment 1 Krinkle 2014-07-01 15:19:26 UTC
Note that OOjs UI, for example, as being a standalone project, never used the 'embed()' function because we use its compiled distribution file which is already CSS (compiled by lessjs via Grunt).

And yet it has no impact on its performance because /* @embed */ degrade gracefully for third parties and is still picked by CSSMin when MediaWIki loads oojs-ui.css.

This is not a coincidence, CSSMin was designed this way on purpose and Less kind of broke that paradigm.
Comment 2 Krinkle 2014-07-01 15:20:55 UTC
This loosely depends on bug 54673. I don't think we have to block on it (it mostly works already) but there's weird edge cases where Less messes up the comments and those are hard to detect so ideally it would "just work" before we give that up.
Comment 3 Matthew Flaschen 2014-07-02 22:04:38 UTC
(In reply to Krinkle from comment #2)
> This loosely depends on bug 54673. I don't think we have to block on it (it
> mostly works already) but there's weird edge cases where Less messes up the
> comments and those are hard to detect so ideally it would "just work" before
> we give that up.

My understanding is those weird edge cases are exactly why the custom functions were introduced, so it does sound like a blocker to me.
Comment 4 Gerrit Notification Bot 2014-09-18 15:13:52 UTC
Change 161245 had a related patch set uploaded by Bartosz Dziewoński:
Fix CSSJanus flipping in LESS mixins and remove broken custom LESS functions

https://gerrit.wikimedia.org/r/161245
Comment 5 Gerrit Notification Bot 2014-09-20 20:59:43 UTC
Change 161751 had a related patch set uploaded by Krinkle:
Fix CSSJanus flipping in LESS mixins and remove broken custom LESS functions

https://gerrit.wikimedia.org/r/161751
Comment 6 Gerrit Notification Bot 2014-09-20 21:05:35 UTC
Change 161245 merged by jenkins-bot:
Fix CSSJanus flipping in LESS mixins and remove broken custom LESS functions

https://gerrit.wikimedia.org/r/161245
Comment 7 Gerrit Notification Bot 2014-09-20 21:07:12 UTC
Change 161751 merged by jenkins-bot:
Fix CSSJanus flipping in LESS mixins and remove broken custom LESS functions

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

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


Navigation
Links