Skip to content

Commit aa062dd

Browse files
committed
DRYer git listings.
1 parent ee0ffff commit aa062dd

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

grunt.js

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ function getLatestStable( organized ) {
125125
var rjQueryVersion = /(jquery-(\d+\.\d+(?:\.\d+)?[^.]*)(?:\.(min|pack))?\.js)/;
126126
var rjQueryMigrateVersion = /(jquery-migrate-(\d+\.\d+(?:\.\d+)?[^.]*)(?:\.min)?\.js)/;
127127
grunt.registerTask( "build-index", function() {
128-
var mainIndex, projectIndex, latestStable,
128+
var mainIndex, projectIndex, latestStable, gitListing,
129129
files = grunt.file.expandFiles( "cdn/**.js" ),
130130
jQueryCoreFiles = parseFiles( files, rjQueryVersion ),
131131
jQueryMigrateFiles = parseFiles( files, rjQueryMigrateVersion ),
@@ -153,13 +153,15 @@ grunt.registerTask( "build-index", function() {
153153
mainIndex += listItem( "jQuery Core", latestStable, jQuery1[ latestStable ] );
154154
mainIndex += "</ul>";
155155

156-
mainIndex += "<h3>jQuery - Live git versions</h3>";
157-
mainIndex += "<p>UNSTABLE, NOT FOR PRODUCTION</p>";
158-
mainIndex += "<ul>";
159-
mainIndex += "<li><a href='/jquery-git2.js'>jQuery 2.x git build</a> - <a href='/jquery-git2.min.js'>minified</a></li>";
160-
mainIndex += "<li><a href='/jquery-git1.js'>jQuery 1.x git build</a> - <a href='/jquery-git1.min.js'>minified</a></li>";
161-
mainIndex += "<li><a href='/jquery-migrate-git.js'>jQuery Migrate git build</a> - <a href='/jquery-migrate-git.min.js'>minified</a></li>";
162-
mainIndex += "</ul>";
156+
gitListing = "<h3>jQuery - Live git versions</h3>";
157+
gitListing += "<p>UNSTABLE, NOT FOR PRODUCTION</p>";
158+
gitListing += "<ul>";
159+
gitListing += "<li><a href='/jquery-git2.js'>jQuery 2.x git build</a> - <a href='/jquery-git2.min.js'>minified</a></li>";
160+
gitListing += "<li><a href='/jquery-git1.js'>jQuery 1.x git build</a> - <a href='/jquery-git1.min.js'>minified</a></li>";
161+
gitListing += "<li><a href='/jquery-migrate-git.js'>jQuery Migrate git build</a> - <a href='/jquery-migrate-git.min.js'>minified</a></li>";
162+
gitListing += "</ul>";
163+
164+
mainIndex += gitListing;
163165

164166
latestStable = getLatestStable( jQueryMigrate );
165167
mainIndex += "<h3>jQuery Migrate - Latest Version</h3>";
@@ -170,13 +172,7 @@ grunt.registerTask( "build-index", function() {
170172

171173
// Build /jquery/
172174
projectIndex = "<script>{\"title\":\"jQuery Core - All Versions\"}</script>\n";
173-
projectIndex += "<h3>jQuery - Live git versions</h3>";
174-
projectIndex += "<p>UNSTABLE, NOT FOR PRODUCTION</p>";
175-
projectIndex += "<ul>";
176-
projectIndex += "<li><a href='/jquery-git2.js'>jQuery 2.x git build</a> - <a href='/jquery-git2.min.js'>min</a></li>";
177-
projectIndex += "<li><a href='/jquery-git1.js'>jQuery 1.x git build</a> - <a href='/jquery-git1.min.js'>min</a></li>";
178-
projectIndex += "<li><a href='/jquery-migrate-git.js'>jQuery Migrate git build</a> - <a href='/jquery-migrate-git.min.js'>min</a></li>";
179-
projectIndex += "</ul>";
175+
projectIndex += gitListing;
180176

181177
projectIndex += "<h2>jQuery Core - All 2.x Versions</h2>";
182178
projectIndex += "<ul>";

0 commit comments

Comments
 (0)