Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Enhancement/template generator #59

Merged
merged 2 commits into from
Jan 22, 2017
Merged

Enhancement/template generator #59

merged 2 commits into from
Jan 22, 2017

Conversation

butlerx
Copy link
Member

@butlerx butlerx commented Jan 22, 2017

close #21

@@ -1,9 +0,0 @@
language: node_js
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this change is being made in #58

@@ -1,34 +1,37 @@
# TechWeek Website [![Build Status](https://travis-ci.org/redbrick/techweek.dcu.ie.svg?branch=master)](https://travis-ci.org/redbrick/techweek.dcu.ie)
# TechWeek Website [![CircleCI](https://circleci.com/gh/redbrick/techweek.dcu.ie/tree/master.svg?style=svg)](https://circleci.com/gh/redbrick/techweek.dcu.ie/tree/master)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move it to another PR? This should be added in #58 but I didn't realize it at the time.

function render (source, events, url) {
let template = Handlebars.compile(source);
let output = template(events);
if (!fs.existsSync(__dirname + '/../dist')) { fs.mkdirSync(__dirname + '/../dist'); }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move fs.mkdirSync to a new line?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes but id rather not


function render (source, events, url) {
let template = Handlebars.compile(source);
let output = template(events);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think inlining this would be neater as template its not used anywhere else.

const output = (Handlebars.compile(source))(events);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const would break it

const events = require(__dirname + '/../events.json');
const template = fs.readFileSync(__dirname + '/../template.handlebars', "utf-8");

function render (source, events, url) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add documentation to this function? What do source, events and url mean in this case.

if (!fs.existsSync(__dirname + '/../dist')) { fs.mkdirSync(__dirname + '/../dist'); }
dir = __dirname + '/../dist';
if (url) {
dir = dir + '/' + url;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use path.join.

fs.mkdirSync(dir);
}
}
fs.writeFile(dir + '/index.html', output, 'utf8', (err) => { if (err) throw err; });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move if statement to a new line?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

considering its an error check id prefer it to be one line

@@ -0,0 +1,3 @@
machine:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was added in #58. Please remove.

"end": 7,
"month": "March",
"year": 2014,
"live": "2014-03-03T12:00:00",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would Unix timestamp be more appropiate? I am not sure is this representation understandable by languages other than JS.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

id prefer the timestamp to be human readable

host: 'techweek.dev',
livereload: true
});
});


gulp.task('fonts', function() {
return gulp.src('./node_modules/materialize-css/fonts/**')
.pipe(gulp.dest('dist/fonts'));
return gulp.src('./node_modules/materialize-css/fonts/**')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should probably make a new issue for this, would moving to https://github.com/material-components/material-components-web be beneficial seeing as its the (yet another) official Material Design framework?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create a new issue for that, would also be good to remove jquery as part of that

Copy link
Member Author

@butlerx butlerx Jan 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue #60 opened for this

@@ -1,183 +0,0 @@
[{
Copy link
Contributor

@SeanHealy33 SeanHealy33 Jan 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm starting to think the json of the site should probably be in a separate repo since it adds a decent bloat to the diff

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah the json was originally never really meant to be part of the repo so moving it to a submoule would proabbly be a good idea

@@ -0,0 +1,74 @@
<!DOCTYPE html>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😍 nice refactor 👍

@butlerx butlerx merged commit c23f17f into redbrick:master Jan 22, 2017
@butlerx butlerx deleted the enhancement/template-generator branch January 22, 2017 22:09
@butlerx butlerx mentioned this pull request Jan 22, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

use gulp to pre generated html files
3 participants