Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
sulkaharo committed Jul 20, 2019
2 parents b627d31 + f874183 commit 41ff79a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ function create(env, ctx) {
}));

const clockviews = require('./lib/server/clocks.js')(env, ctx);
clockviews.setLocals(app.locals);

app.use("/clock", clockviews);

app.get("/", (req, res) => {
Expand Down
8 changes: 7 additions & 1 deletion lib/server/clocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const path = require('path');
function clockviews(env, ctx) {

const app = new express();
let locals = {};

app.set('view engine', 'ejs');
app.engine('html', require('ejs').renderFile);
Expand All @@ -18,11 +19,16 @@ function clockviews(env, ctx) {
console.log('Clockface requested:', face);

res.render('shared.html', {
face
face,
locals
});

});

app.setLocals = function (_locals) {
locals = _locals;
}

return app;
}

Expand Down
2 changes: 1 addition & 1 deletion views/clockviews/shared.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</main>

<script src="/api/v1/status.js"></script>
<script src="/js/bundle.clock.js?v=<%= locals.cachebuster %>"></script>
<script src="<%= locals.bundle %>/js/bundle.clock.js?v=<%= locals.cachebuster %>"></script>

<script type="text/javascript">
let clockFace = "<%= face %>"; // can now be used in scripts
Expand Down

0 comments on commit 41ff79a

Please sign in to comment.