microjam icon indicating copy to clipboard operation
microjam copied to clipboard

initial template.js issues

Open dmitrijLo opened this issue 5 years ago • 4 comments

there have been some issues with the initial template.js. By the way these arise when going through the "A New Project"-Guide of the microJam pages.

1.) Creating a Markdown-File with "layout": "page" works and initiates styles.css and template.css. But changing the layout to "article" causes an error message "tmpl is not defined".

2.) When using "layout":"index" as explained in "index document" this error occurs: "tmpl.base is not a function".

dmitrijLo avatar Nov 16 '20 10:11 dmitrijLo

this could be the issue for 1.): https://github.com/goessner/microjam/blob/master/microjam.js#L438 image we already had changed this to const tmpl = module.exports = ... why is this again?

dmitrijLo avatar Nov 16 '20 10:11 dmitrijLo

for the second issue: @line 49 .base is not defined. this probably should be return tmpl.page(date) https://github.com/goessner/microjam/blob/master/microjam.js#L486

image

dmitrijLo avatar Nov 16 '20 10:11 dmitrijLo

I would also like to propose the following:

ext.defaults = {
    templates: fs.readFileSync(path.join(
        vscode.extensions.getExtension('goessner.microjam').extensionPath, 'defaults.js'))
        .toString(),
    css: fs.readFileSync(path.join(
        vscode.extensions.getExtension('goessner.microjam').extensionPath, 'defaults.css'))
        .toString(),
};

Basically I just want to put the template strings: https://github.com/goessner/microjam/blob/master/microjam.js#L436 into their own files.

I do think this would make things easier to maintain.

klawr avatar Nov 16 '20 12:11 klawr

Respective PR: https://github.com/goessner/microjam/pull/13

klawr avatar Nov 16 '20 12:11 klawr