[Checkins] SVN: hurry.yui/trunk/s Update to work with hurry.resource 0.3. Extend tests so that they
Martijn Faassen
faassen at infrae.com
Wed Oct 15 13:28:05 EDT 2008
Log message for revision 92246:
Update to work with hurry.resource 0.3. Extend tests so that they
exercise minified/rollup resources.
Changed:
U hurry.yui/trunk/setup.py
U hurry.yui/trunk/src/hurry/yui/basic.txt
U hurry.yui/trunk/src/hurry/yui/depend.py
-=-
Modified: hurry.yui/trunk/setup.py
===================================================================
--- hurry.yui/trunk/setup.py 2008-10-15 17:26:53 UTC (rev 92245)
+++ hurry.yui/trunk/setup.py 2008-10-15 17:28:04 UTC (rev 92246)
@@ -34,7 +34,7 @@
zip_safe=False,
install_requires=[
'setuptools',
- 'hurry.resource',
+ 'hurry.resource > 0.2',
'simplejson',
],
entry_points= {
Modified: hurry.yui/trunk/src/hurry/yui/basic.txt
===================================================================
--- hurry.yui/trunk/src/hurry/yui/basic.txt 2008-10-15 17:26:53 UTC (rev 92245)
+++ hurry.yui/trunk/src/hurry/yui/basic.txt 2008-10-15 17:28:04 UTC (rev 92246)
@@ -36,16 +36,43 @@
<link rel="stylesheet" type="text/css" href="http://localhost/static/yui/fonts/fonts.css" />
<link rel="stylesheet" type="text/css" href="http://localhost/static/yui/grids/grids.css" />
+Let's need two resources at the same time::
+
+ >>> needed = NeededInclusions()
+ >>> needed.need(yui.grids)
+ >>> needed.need(yui.reset)
+ >>> print needed.render()
+ <link rel="stylesheet" type="text/css" href="http://localhost/static/yui/fonts/fonts.css" />
+ <link rel="stylesheet" type="text/css" href="http://localhost/static/yui/grids/grids.css" />
+ <link rel="stylesheet" type="text/css" href="http://localhost/static/yui/reset/reset.css" />
+
+Let's get the same, minified::
+
+ >>> needed.mode('minified')
+ >>> print needed.render()
+ <link rel="stylesheet" type="text/css" href="http://localhost/static/yui/fonts/fonts-min.css" />
+ <link rel="stylesheet" type="text/css" href="http://localhost/static/yui/grids/grids-min.css" />
+ <link rel="stylesheet" type="text/css" href="http://localhost/static/yui/reset/reset-min.css" />
+
Now let's try to see consolidation: we include grids and reset at the
-same time, and we expect a consolidation to ``reset-fonts-grids``::
+same time. Since this time we enable rolling up, we expect to see the
+rollup ``reset-fonts-grids``::
>>> needed = NeededInclusions()
+ >>> needed.rollup()
>>> needed.need(yui.grids)
>>> needed.need(yui.reset)
>>> print needed.render()
<link rel="stylesheet" type="text/css" href="http://localhost/static/yui/reset-fonts-grids/reset-fonts-grids.css" />
-Let's get the same, minified::
+Requesting minification has no effect on rollups, as the original
+rollup is already minified::
- >>> print needed.render(mode="minified")
- <link rel="stylesheet" type="text/css" href="http://localhost/static/yui/reset-fonts-grids/reset-fonts-grids-min.css" />
+ >>> needed = NeededInclusions()
+ >>> needed.rollup()
+ >>> needed.mode('minified')
+ >>> needed.need(yui.grids)
+ >>> needed.need(yui.reset)
+ >>> print needed.render()
+ <link rel="stylesheet" type="text/css" href="http://localhost/static/yui/reset-fonts-grids/reset-fonts-grids.css" />
+
Modified: hurry.yui/trunk/src/hurry/yui/depend.py
===================================================================
--- hurry.yui/trunk/src/hurry/yui/depend.py 2008-10-15 17:26:53 UTC (rev 92245)
+++ hurry.yui/trunk/src/hurry/yui/depend.py 2008-10-15 17:28:04 UTC (rev 92246)
@@ -60,10 +60,10 @@
def convert_to_mode(inclusion, mode):
rest, ext = os.path.splitext(inclusion.relpath)
- if mode == 'minified':
+ if mode == 'minified' and not inclusion.supersedes:
result = ResourceInclusion(inclusion.library,
rest + '-min' + ext)
- elif mode == 'debug':
+ elif mode == 'debug' and not inclusion.supersedes:
result = ResourceInclusion(inclusion.library,
rest + '-debug' + ext)
else:
More information about the Checkins
mailing list