MBS-6428: LESS css preprocessor

Merged
#251 · Created  · Last updated

Merged pull request

Merge branch 'beta' into less

3be4b41·Author: ·Closed by: ·2013-07-08

Description

This is just the very absolute basics here; trying to keep this as small as I can for review. This is the minimal changes to make it possible for us to use LESS as a CSS preprocessor. The reason I've chosen this specifically is because, unlike any other, it supports a no-explicit-compilation-step method of working, where (for development, obviously) it just has the browser do the compilation to CSS.

To maintain our current features re: manifests, hashes, etc., has been a bit more complex. Specifically: common.css.manifest has just become a single line of common.css, which is not a file that's checked into the repository. common.less, however, is, and is compiled into common.css by compile_resources calling out to lessc. common.less then has (in LESS format) the list of actual dependencies that was formerly in common.css.manifest. It would initially seem more beneficial to simply ditch the css manifest entirely -- the reason this doesn't do that is that taking a given LESS file and expanding it to all source files it uses is not an entirely trivial task, which is necessary for calculating the hash for the compiled .css file. However, we can sidestep it as I have: by compiling the LESS to CSS, we can once again do the simple MD5 calculation. It means that common.css.manifest is largely a stub, but I think this is fine; all the manifest signature machinery is still needed for javascript compilation.

Though they'll show as changed below because I've renamed them to .less, the actual CSS files have not changed in large part from this patch -- I'll leave that for other patches. The changes I have done:

  1. removing ie6 hacks from thickbox.css. It's not a browser we support and LESS was complaining about it. I could have used the ~ feature of less to get around this, but honestly I don't think it's worth it. Note that since this is a file we presumably don't have any intention of actually using LESS features for, I've simply added a thickbox.css.less symlink in order to get the file extension "right" for LESS. (for .css files it doesn't touch @import directives, which is bad -- we want to compile into one file -- the LESS 1.4.0 beta has a feature for specifying how to treat imports, but we can't count on having that (especially not from packages)). See https://bitbucket.org/ianmcorvidae/musicbrainz-server/commits/b20c42d42a36f3f0c9b1f5ee5109eb3cfb1d47bb

  2. Removing one bit of invalid CSS where we had text-align; right; instead of text-align: right, and a mispelled selector. See https://bitbucket.org/ianmcorvidae/musicbrainz-server/commits/a411f98b5fbc54b8a305175e70c16b08cce3bd24

We can't ship this until we have lessc on our servers, also, which at present means it's waiting on me to move forward with getting ubuntu 12.04 onto them. I have a second branch for pulling out colors and giving them names; I want to finish extracting and then improve the names before putting it up for review, but my work can be tracked by http://mbsandbox.org/~ianmcorvidae/colors.html and https://gist.github.com/ianmcorvidae/0d40c2d8258850f3dc56 (color documentation page, list of all colors I could find, respectively).

UPDATE: move to a local copy of lessc with a package.json. This means we only need nodejs from repositories, which means this doesn't need to depend on us moving to ubuntu 12.04.

UPDATE: unminified less.js, update to current master (update again: current beta)

UPDATE: broken diff correction

UPDATE: licensing info

0 attachments

0 comments

Loading commits...