[Fedora-packaging] Web Assets/JavaScript guideline drafts

T.C. Hollingsworth tchollingsworth at gmail.com
Tue Jul 16 14:19:08 UTC 2013

On 7/16/13, Joe Orton <jorton at redhat.com> wrote:
> On Wed, Jul 10, 2013 at 09:32:12AM -0700, T.C. Hollingsworth wrote:
>> And some guidelines for the other various shareable bits that aren't
>> JavaScript:
>> https://fedoraproject.org/wiki/User:Patches/PackagingDrafts/Web_Assets
> I strongly agree with Remi that in general it is better to be using a
> webserver-level "Alias" (i.e. a URL -> filesystem mapping) to bring
> shared "assets" within a webapp-specific URL space.  i.e. Alias
> /myapp/some.js to /usr/blah/some.js

This is totally fine; the draft guidelines explicitly permit this.

But if your webapp has a lot of JS dependencies adding a million Alias
lines to your apache config can be just as painful as forcing it to
use the shared URL space.

Keep in mind that many webapps/frameworks let you specify URLs for JS
and such in their config (e.g. to support CDNs like googleapis.com) so
both approaches could be equally easy/hard to implement depending on
what you're doing.

In those cases whether you have /etc/httpd/conf.d/myapp.conf with:
Alias /myapp/js/jquery.js /usr/share/javascript/jquery/jquery-min.js
Alias /myapp/js/jquery-ui.js /usr/share/assets/jquery-ui/js/jquery-ui-min.js

or /usr/share/myapp/config.php with:
$js['jquery'] = "/_assets/javascript/jquery/jquery-min.js";
$js['jquery-ui'] = "/_assets/jquery-ui/js/jquery-ui-min.js";

is really just a matter of taste.

> Patching webapps *right down to content level* to enforce our particular
> choice of URL space sounds like a maintenance nightmare.

Again, I have no intention of forcing people to use the shared URL
space.  It's just another option for those who want it.

> If we really must pollute the URL space with fixed common locations for
> shared assets then we should definitely not use a generic name like
> "/assets".  We should minimize interference with the URL space.
> "/.assets" "/.packaged-assets" "/_packaged_assets/" or something like
> that.

The previous guidelines draft called for every JS library under the
sun to take it's own path in the URL space.  (/jquery, /jquery-ui, and
so on).  I figured the One Directory to Rule Them All was a great
improvement on this.

I don't particularly care what the directory ends up being.  If you as
the httpd maintainer would prefer it to be dot or underscore-prefixed
I'd be happy to amend the guidelines to reflect that.  (Dot-prefixing
seems a little weird in this case as the directory really isn't
"hidden", but an underscore seems fine to me.)


More information about the packaging mailing list