Minfying your stylesheets and script files improves your site’s performance.
However, sometimes you might want to make the non-minified versions of the files available – perhaps to comply with the GPL or to implement the optional code-on-demand REST constraint.
Is there a standardised way of doing this? The only way I can think of is to use a naming convention:
http://example.com/css/styles.min.css – minified version
http://example.com/css/styles.css – non-minified version
The trouble with this approach is that it relies on an out-of-band convention. Is there any more rigorous way of implementing non-minified code-on-demand?
You could have some form of handler (e.g. a .NET handler) for .css files that serves up the minified version by default, but if a certain parameter was found in the querystring (e.g. debug=true) then serve up the non-minified version.
That way you can always reference the .css version, and if there is a minified version available, that can be used in preference.
Suggestion: Use Hypermedia. Benefit: Your choice of URIs doesn’t matter as much.
If providing sources in a visible fashion to your end-user, in the course of their normal use of your web application:
If providing sources to developer users, outside course of their normal use of the web application, it might make sense to reference them in a non-visible section of the source:
These links will only be available to developers who view the source of the HTML, or folks who have really tricked-out user-agents.
Along the same lines, you could put the non-minified CSS (but not JS) source as an alternate stylesheet.
rel="sourcecode" isn’t a standard (I just made it up), but I’m pretty sure it doesn’t violate spec; and along with the
title it helps to communicate the purpose of the link.