Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates plugin.views Reference.md entry to a clear and working example #1113

Merged
merged 1 commit into from
Oct 26, 2013
Merged

updates plugin.views Reference.md entry to a clear and working example #1113

merged 1 commit into from
Oct 26, 2013

Conversation

pletcher
Copy link
Contributor

The current example for setting plugin-specific views engines breaks because require('jade') returns an object (and so extends and invalidates the options that get passed to pack.views). It also does not clearly show that "jade" refers to the file extension and not the module itself:

exports.register = function (plugin, options, next) {

    plugin.views({
        engines: {
            jade: require('jade') 
        },
        path: './templates'
    });

    next();
};

I'm proposing a simple change to the following, which tries to clarify that "html" refers to the file extension of the view template and also shows a working example that follows the guidelines specified in the docs:

exports.register = function (plugin, options, next) {

    plugin.views({
        engines: {
            html: { 
              module: require('handlebars') 
            }
        },
        path: './templates'
    });

    next();
};

hueniverse pushed a commit that referenced this pull request Oct 26, 2013
updates plugin.views Reference.md entry to a clear and working example
@hueniverse hueniverse merged commit 6dc33f5 into hapijs:master Oct 26, 2013
jmonster pushed a commit to jmonster/hapi that referenced this pull request Feb 10, 2014
updates plugin.views Reference.md entry to a clear and working example
@lock lock bot locked as resolved and limited conversation to collaborators Jan 10, 2020
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.

2 participants