goessner / microjam

A minimalistic Jamstack approach for creating GitHub-Pages hosted sites.
https://goessner.github.io/microjam/
MIT License
44 stars 5 forks source link

initial template.js issues #12

Open dmitrijLo opened 3 years ago

dmitrijLo commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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
klawr commented 3 years ago

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 commented 3 years ago

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