Skip to main content

fanstatic YUI

Project description

js.yui

Introduction

This library packages YUI for fanstatic. It is aware of YUI’s structure and different modes (normal, minified, debug).

This requires integration between your web framework and fanstatic, and making sure that the original resources (shipped in the resources directory in js.yui) are published to some URL.

js.yui basic tests

Here are some basic tests for js.yui.

Let’s check the YUI structure by picking out a resource in it:

>>> import js.yui
>>> from fanstatic import init_needed
>>> needed = init_needed(base_url='http://localhost')
>>> needed.need(js.yui.fonts)
>>> print needed.render()
<link rel="stylesheet" type="text/css" href="http://localhost/fanstatic/yui/fonts/fonts.css" />

Let’s try a resource that has a dependency on fonts, namely grids:

>>> needed = init_needed(base_url='http://localhost')
>>> needed.need(js.yui.grids)
>>> print needed.render()
<link rel="stylesheet" type="text/css" href="http://localhost/fanstatic/yui/fonts/fonts.css" />
<link rel="stylesheet" type="text/css" href="http://localhost/fanstatic/yui/grids/grids.css" />

Let’s need two resources at the same time:

>>> needed = init_needed(base_url='http://localhost')
>>> needed.need(js.yui.grids)
>>> needed.need(js.yui.reset)
>>> print needed.render()
<link rel="stylesheet" type="text/css" href="http://localhost/fanstatic/yui/fonts/fonts.css" />
<link rel="stylesheet" type="text/css" href="http://localhost/fanstatic/yui/grids/grids.css" />
<link rel="stylesheet" type="text/css" href="http://localhost/fanstatic/yui/reset/reset.css" />

Let’s get the same, minified:

>>> needed = init_needed(base_url='http://localhost', mode='minified')
>>> needed.need(js.yui.grids)
>>> needed.need(js.yui.reset)
>>> print needed.render()
<link rel="stylesheet" type="text/css" href="http://localhost/fanstatic/yui/fonts/fonts-min.css" />
<link rel="stylesheet" type="text/css" href="http://localhost/fanstatic/yui/grids/grids-min.css" />
<link rel="stylesheet" type="text/css" href="http://localhost/fanstatic/yui/reset/reset-min.css" />

Now let’s try to see consolidation: we include grids and reset at the same time. Since this time we enable rolling up, we expect to see the rollup reset-fonts-grids:

>>> needed = init_needed(
...     base_url='http://localhost', rollup=True)
>>> needed.need(js.yui.grids)
>>> needed.need(js.yui.reset)
>>> print needed.render()
<link rel="stylesheet" type="text/css" href="http://localhost/fanstatic/yui/reset-fonts-grids/reset-fonts-grids.css" />

Requesting minification has no effect on rollups, as the original rollup is already minified:

>>> needed = init_needed(
...     base_url='http://localhost', rollup=True, mode='minified')
>>> needed.need(js.yui.grids)
>>> needed.need(js.yui.reset)
>>> print needed.render()
<link rel="stylesheet" type="text/css" href="http://localhost/fanstatic/yui/reset-fonts-grids/reset-fonts-grids.css" />

CHANGES

2.8.2 (2011-01-07)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

js.yui-2.8.2.tar.gz (2.3 MB view details)

Uploaded Source

File details

Details for the file js.yui-2.8.2.tar.gz.

File metadata

  • Download URL: js.yui-2.8.2.tar.gz
  • Upload date:
  • Size: 2.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for js.yui-2.8.2.tar.gz
Algorithm Hash digest
SHA256 3a146640f583dd8613fdbf29f7901c91161d759492b5da125780a86a1a5a5f95
MD5 20c472b76f284ad7fa89cfbf8cc4a49b
BLAKE2b-256 7be9dbec47faaf62463553fecb9c3f2cd683b8052f0ac3eb5c2830e17d03009d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page