Skip to content

Commit cbb27c0

Browse files
committed
Less versions coupling in .hbs templates.
Simpler way of fetching current version of the project: `project.currentVersion` rather than `project.versions.0.version` meaning less coupling and in a sence logic in the .hbs templates.
1 parent e96a2cd commit cbb27c0

5 files changed

Lines changed: 13 additions & 11 deletions

File tree

‎build.js‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ const path = require('path');
1515
const fs = require('fs');
1616
const ncp = require('ncp');
1717

18-
const filterStylusPartials = require('./plugins/filter-stylus-partials.js');
19-
const mapHandlebarsPartials = require('./plugins/map-handlebars-partials.js');
18+
const filterStylusPartials = require('./plugins/filter-stylus-partials');
19+
const mapHandlebarsPartials = require('./plugins/map-handlebars-partials');
20+
const versions = require('./source/versions');
2021

2122
/** Build **/
2223

@@ -49,7 +50,8 @@ function traverse (obj, str) {
4950

5051
const source = {
5152
project: {
52-
versions: require('./source/versions.json')
53+
versions,
54+
currentVersion: versions[0].version
5355
}
5456
};
5557

‎layouts/download.hbs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ section h2 {
2828

2929
<section>
3030
<h2>io.js</h2>
31-
<strong>Current version: {{project.versions.0.version}}</strong>
31+
<strong>{{current-version}}: {{project.currentVersion}}</strong>
3232
<p>
3333
{{iojs.intro}}
3434
</p>

‎layouts/index.hbs‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
<div class="home-download">
1515
<img src="/static/images/logo-hexagon.svg" alt="node.js" class="home-logo">
1616
<div class="home-download-details">
17-
<p class="home-download-version"><a href="https://iojs.org/dist/v{{ version }}/">Version {{ version }}</a></p>
17+
<p class="home-download-version"><a href="https://iojs.org/dist/{{ project.currentVersion }}/">Version {{ project.currentVersion }}</a></p>
1818
<p class="home-download-list">
19-
{{download-text}} <a href="https://iojs.org/dist/v{{ version }}/iojs-v{{ version }}-linux-x64.tar.xz">Linux</a>,
20-
<a href="https://iojs.org/dist/v{{ version }}/iojs-v{{ version }}-x86.msi">Win32</a>,
21-
<a href="https://iojs.org/dist/v{{ version }}/iojs-v{{ version }}-x64.msi">Win64</a>,
22-
<a href="https://iojs.org/dist/v{{ version }}/iojs-v{{ version }}.pkg">Mac</a> &amp;
23-
<a href="https://iojs.org/dist/v{{ version }}/">Others</a>
19+
{{download-text}} <a href="https://iojs.org/dist/{{ project.currentVersion }}/iojs-{{ project.currentVersion }}-linux-x64.tar.xz">Linux</a>,
20+
<a href="https://iojs.org/dist/{{ project.currentVersion }}/iojs-{{ project.currentVersion }}-x86.msi">Win32</a>,
21+
<a href="https://iojs.org/dist/{{ project.currentVersion }}/iojs-{{ project.currentVersion }}-x64.msi">Win64</a>,
22+
<a href="https://iojs.org/dist/{{ project.currentVersion }}/iojs-{{ project.currentVersion }}.pkg">Mac</a> &amp;
23+
<a href="https://iojs.org/dist/{{ project.currentVersion }}/">Others</a>
2424
</p>
2525
<p><a href="https://github.com/nodejs/io.js/blob/master/CHANGELOG.md">Changelog</a></p>
2626
</div>

‎locale/en/download.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
layout: download.hbs
33
title: Download
44
introduction: Download the Node.js source code or a pre-built installer for your platform, and start developing today.
5+
current-version: Current version
56
iojs:
67
intro: "In May 2015, the io.js project TSC voted to join the Node.js Foundation and merge back with Node.js.
78
While the project streams are being converged, io.js releases will continue in parallel."

‎locale/en/index.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
title: new.nodejs.org
33
layout: index.hbs
4-
version: 2.5.0
54
download-text: 'Download for'
65
description: Bringing the converged nodejs.org/iojs.org to the Node Community!
76
updates:

0 commit comments

Comments
 (0)