From Fedora Project Wiki
(→‎Server Location: permit aliases or symlinks)
(→‎Fonts: prohibit fonts outside /usr/share/fonts)
Line 77: Line 77:
All system fonts (available in <code>%{_datadir}/fonts</code> are automatically made available in <code>/assets/fonts/</code> via a symlink.  For more information on packaging system fonts, see the [[Packaging:FontsPolicy|font guidelines]].
All system fonts (available in <code>%{_datadir}/fonts</code> are automatically made available in <code>/assets/fonts/</code> via a symlink.  For more information on packaging system fonts, see the [[Packaging:FontsPolicy|font guidelines]].


Additionally, fonts in formats that are supported by W3C standards, but not supported by Fedora applications (like [https://en.wikipedia.org/wiki/WOFF WOFF]) may be shipped in <code>%{_assetdir}</code>.  This may be necessary [http://caniuse.com/fontface for compatibility with older web browsers].  Such packages must follow the [[Packaging:FontsPolicy|font guidelines]], with the following exceptions:
Please note that those guidelines prohibit packaging fonts elsewhere. There is no compelling reason to support other font formats, as most browsers that support web fonts support the TTF or OTF formats used by system fonts, therefore alternative web font formats like WOFF are prohibited.
* The fonts must be shipped in a subdirectory of <code>%{_assetdir}</code>, not <code>%{_datadir}/fonts</code>.
* The package (which may be a subpackage of a SRPM that ships standard system fonts) must use <code>-webfonts</code> as the suffix instead of <code>-fonts</code>.
* Fonts must be in a W3C-approved format that is not TrueType (TTF) or OpenType (OTF) (which should be packaged as normal system fonts).  Currently, this includes the Web Open Font Format (WOFF) and SVG fonts.
* System <code>-fonts</code> packages must not depend on <code>-webfonts</code> package as described here.
* Additionally, a web fonts package may contain symlinks to the system fonts location where necessary to permit fallback mechanisms to work.
 
If at all possible, fonts available under web font formats should also be available in the Fedora Package Collection as system fonts as well.

Revision as of 08:46, 16 July 2013

Scope

Web Assets are any static content that are shipped intact to web browsers, usually by web applications. These might be user interface frameworks, Flash video players, CSS frameworks, icon libraries, or lots of other possibilities.

If your package is primarily or solely shipped to a browser and not used locally, and is not JavaScript, it probably falls under these guidelines. JavaScript packages must follow the JavaScript guidelines in addition to these guidelines.

Web applications typically involve code that is executed locally, and thus do not fall under these guidelines.

Rationale

There are lots of little bits shipped to browsers that aren't just JavaScript that typically have been bundled along with web applications up to this point. There are a lot of good reasons why we shouldn't bundle JavaScript this way, so it only follows that we should fix it for the rest of that kind of stuff too.

BuildRequires

To ensure the presence of the necessary RPM macros, all packages that provide web assets must have:

BuildRequires:  web-assets-devel

Requires

To ensure the availability of the necessary directories, all packages that provide web assets must have:

Requires:  web-assets-filesystem

RPM Macros

Macro Normal Definition Notes
_assetdir %{_datadir}/assets The directory where all web assets are stored

Install Location

All web asset packages must install into a subdirectory of %{_assetdir}. For instance, the jquery-ui package should install itself into %{_assetdir}/jquery-ui.

Server Location

All HTTP daemons in the distribution should make %{_assetdir} available in /assets.

Therefore, if the fabulous-web-icons package ships an icon as %{_assetdir}/fabulous-web-icons/important.png, you can include it in a web application with the following HTML:

<img src="/assets/fabulous-web-icons/important.png">

Regardless, web applications may want to make subdirectories of %{_assetdir} available under their own directory via aliases or symlinks for compatibility purposes or to eliminate needless deviation from upstream.

Content Guidelines

Web Assets should follow the general guidelines for content, unless stated otherwise in this document.

CSS

Pure CSS frameworks can be included as-is. CSS frameworks that use an alternative language that compiles to CSS, such as LESS, must compile to CSS as part of the build process. It is not acceptable to include pre-compiled CSS in Fedora packages.

Flash

Flash files (which typically use the .swf extension) must follow the general and licensing guidelines for code, not content. Non-free Flash files are unacceptable in Fedora.

Unfortunately, it may not be possible to build some Flash files using free software toolchains. Therefore, it is permissible for precompiled Flash files to be included in Fedora packages. However, the source code must still be included as part of the SRPM.

Note.png
Not sure if this is a good idea
I'm not entirely sure this is a great idea, but on the other hand it would suck if some awesome web video player that mostly did HTML5 but had a freely-licensed Flash fallback were blocked from Fedora because there isn't a free Flash toolchain.

If the Flash software supports being compiled by a free software toolchain, such as swfc, it must be compiled as part of the build process for that package.

Java applets

Java applets should follow the general and licensing guidelines for code, not content. Additionally, they should follow the Java guidelines, with the exception that the actual .jar file for the Java applet should be installed into a subdirectory of %{_assetdir}.

Images

Images that are part of a larger Web Asset package can be included in that package's subdirectory. For instance, a UI library might contain images for its UI components in its subdirectory.

Web Asset packages that consist solely of images, such as a set of icons, may be shipped as their own package.

Fonts

All system fonts (available in %{_datadir}/fonts are automatically made available in /assets/fonts/ via a symlink. For more information on packaging system fonts, see the font guidelines.

Please note that those guidelines prohibit packaging fonts elsewhere. There is no compelling reason to support other font formats, as most browsers that support web fonts support the TTF or OTF formats used by system fonts, therefore alternative web font formats like WOFF are prohibited.