Skip to content

Commit 750ded5

Browse files
committed
Added QUnit listing.
1 parent 3898f71 commit 750ded5

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

grunt.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,21 @@ grunt.registerTask( "build-index", function() {
265265
};
266266
}
267267

268+
function getQunitData() {
269+
var files = grunt.file.expandFiles( "cdn/qunit/*.js" ),
270+
releases = parseReleases( files,
271+
/(qunit\/qunit-(\d+\.\d+\.\d+[^.]*)(?:\.(min))?\.js)/ );
272+
273+
releases.forEach(function( release ) {
274+
release.theme = release.filename.replace( ".js", ".css" );
275+
});
276+
277+
return {
278+
latestStable: getLatestStable( releases ),
279+
all: releases
280+
};
281+
}
282+
268283
Handlebars.registerHelper( "release", function( prefix, release ) {
269284
var html = prefix + " " + release.version + " - " +
270285
"<a href='/" + release.filename + "'>uncompressed</a>";
@@ -308,6 +323,7 @@ grunt.registerTask( "build-index", function() {
308323
data.ui = getUiData(),
309324
data.color = getColorData();
310325
data.mobile = getMobileData();
326+
data.qunit = getQunitData();
311327

312328
grunt.file.write( "dist/wordpress/posts/page/index.html",
313329
Handlebars.compile( grunt.file.read( "templates/index.hbs" ) )( data ) );
@@ -323,6 +339,9 @@ grunt.registerTask( "build-index", function() {
323339

324340
grunt.file.write( "dist/wordpress/posts/page/mobile.html",
325341
Handlebars.compile( grunt.file.read( "templates/mobile.hbs" ) )( data ) );
342+
343+
grunt.file.write( "dist/wordpress/posts/page/qunit.html",
344+
Handlebars.compile( grunt.file.read( "templates/qunit.hbs" ) )( data ) );
326345
});
327346

328347
};

templates/index.hbs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,19 @@
9898
</li>
9999
</ul>
100100
{{/with}}
101+
102+
<h2>QUnit</h2>
103+
<p>
104+
Showing the latest stable release for QUnit.
105+
<a href="/qunit/">See all versions of QUnit</a>.
106+
</p>
107+
108+
{{#with qunit.latestStable}}
109+
<ul>
110+
<li>
111+
QUnit {{version}} -
112+
<a href="/{{filename}}">uncompressed</a>,
113+
<a href="/{{theme}}">theme</a>
114+
</li>
115+
</ul>
116+
{{/with}}

templates/qunit.hbs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<script>{
2+
"title": "QUnit - All Versions"
3+
}</script>
4+
5+
{{#each qunit.all}}
6+
<li>
7+
QUnit {{version}} -
8+
<a href="/{{filename}}">uncompressed</a>,
9+
<a href="/{{theme}}">theme</a>
10+
</li>
11+
{{/each}}

0 commit comments

Comments
 (0)