Skip to content
Permalink
Browse files

fixed string interpolation

  • Loading branch information
y-a-v-a committed Sep 28, 2019
1 parent fe49197 commit e8e3effcad05280c69d0806152af0575eaabea2f
Showing with 18 additions and 7 deletions.
  1. +2 βˆ’1 app.js
  2. +2 βˆ’0 fetch.js
  3. +1 βˆ’1 public/stylesheets/style.css
  4. +11 βˆ’3 routes/index.js
  5. +1 βˆ’1 views/download.pug
  6. +1 βˆ’1 views/layout.pug
3 app.js
@@ -8,11 +8,12 @@ var fs = require('fs');

var app = express();

// @see fetch.js
var fontVersionFile = './font-version';
var fontVersion = '0.0.0';
try {
var fontVersion = fs.readFileSync(fontVersionFile);
app.set('font-version', `-${fontVersion}`);
app.set('font-version', fontVersion);
} catch(e) {
console.log(`Unable to read file: ${fontVersionFile}`);
process.exit(1);
@@ -65,6 +65,8 @@ async function main() {

debug('Done');

// store the new version in a file to be used
// by the webapp to serve the latest version
fs.writeFileSync('./font-version', newVersion);
}
});
@@ -13,7 +13,7 @@ body {
}

.with-on-kawara-font {
font-family: OnKawara, Helvetica;
font-family: AanArwok, Helvetica;
}

/*
@@ -12,28 +12,36 @@ var title = 'On Kawara font';
/* GET home page. */
router.get('/', function(req, res, next) {
const today = (new Date()).toLocaleDateString('en-US', localizeOptions).replace(/ /g, '');
const fontVersionValue = req.app.get('font-version');
const fontVersion = `-${fontVersionValue}`;

const responseData = {
title,
date: today,
theme: res.locals.theme,
fontVersion: req.app.get('font-version')
fontVersion
};

res.render('index', responseData);
});

router.get('/about', function(req, res, next) {
const fontVersionValue = req.app.get('font-version');
const fontVersion = `-${fontVersionValue}`;

res.render('about', {
title: `${title} about`,
fontVersion: req.app.get('font-version')
fontVersion
});
});

router.get('/download', function(req, res, next) {
const fontVersionValue = req.app.get('font-version');
const fontVersion = `-${fontVersionValue}`;

res.render('download', {
title: `${title} download`,
fontVersion: req.app.get('font-version')
fontVersion
});
});

@@ -3,7 +3,7 @@ extends layout
block content
.canvas
h1
a(href='/fonts/OnKawara-Regular#{fontVersion}.otf') Download
a(href=`/fonts/OnKawara-Regular${fontVersion}.otf`) Download
.meta
p Download the On Kawara font via clicking 'Download'
p
@@ -6,7 +6,7 @@ html(lang='en-US')
link(rel='stylesheet', href='/stylesheets/style.css')
style.
@font-face {
font-family: OnKawara;
font-family: AanArwok;
src: url("/fonts/OnKawara-Regular#{fontVersion}.otf") format("opentype");
}
body, a, a:visited, a:active { color: !{theme.fg}; }

0 comments on commit e8e3eff

Please sign in to comment.
You can’t perform that action at this time.