Skip to content
This repository has been archived by the owner on Dec 5, 2018. It is now read-only.

Can only use .marko extension for layouts? #2

Closed
snapwich opened this issue Jul 22, 2015 · 3 comments
Closed

Can only use .marko extension for layouts? #2

snapwich opened this issue Jul 22, 2015 · 3 comments

Comments

@snapwich
Copy link

I'm guessing Marko is meant to support more than just a .marko extension since the install has a configuration option for other extensions like so: require('marko/node-require').install({extension: ".html"});

That works for single files but if I have the following:

<layout-use template="../layouts/page.html">
    <layout-put into="content">test content</layout-put>
</layout-use>

I get the following error:

node_modules\marko\runtime\helpers.js:129
                return req('view-engine').load(path);
                       ^
TypeError: undefined is not a function

The same error seems to be true for includes as well. Is there some more configuration I'm missing somewhere?

@patrick-steele-idem
Copy link
Contributor

You are right that Marko should allow other file extensions. I've not run into the issue you are seeing because I only using the .marko extension, but it is indeed a bug that should be fixed...

Interestingly, Marko allows templates of other types to be included by going through the view-engine module. The view-engine module normalizes the API for various templating engines and we use the file extension to determine the template type. When doing an include if Marko doesn't recognize the file extension of the template it attempts to load the template through the view-engine module (which is not available in your case).

I'll put in a simple fix in a few minutes. Thanks.

patrick-steele-idem added a commit to marko-js/marko that referenced this issue Jul 22, 2015
patrick-steele-idem added a commit to marko-js/marko that referenced this issue Jul 22, 2015
@patrick-steele-idem
Copy link
Contributor

Issue fixed and test case added. New version of marko published: marko@2.7.7

Thanks for reporting the problem.

@snapwich
Copy link
Author

Thanks for the super fast response and resolution!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants