You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In case someone wants to add extra content (e.g. an additional script ) in the existing template, it would be good to be able to do it also from inside template function (instead of copying/editing the default template). To achieve this, the default template should be added in locals object passed to template function.
The advantage of this is that on a later package upgrade, the template will be always up-to-date with the authors' version (plus the edits).
The text was updated successfully, but these errors were encountered:
Hi @ghuser thanks for the suggestion! Sorry for the delay on the response. If you are still interested, I do have a question on the use-case: given if you have the template in locals object, can you give an example of the code for how you intend to add the additional script?
template(locals,callback){const$=require('cheerio').load(locals.template);$('head').append(`<script>console.log('hello from injected script')</script>`)// I don't know what error should be (function or value) so I leave it `undefined`callback(undefined,$.html());}
In case someone wants to add extra content (e.g. an additional script ) in the existing template, it would be good to be able to do it also from inside template function (instead of copying/editing the default template). To achieve this, the default template should be added in
locals
object passed to template function.The advantage of this is that on a later package upgrade, the template will be always up-to-date with the authors' version (plus the edits).
The text was updated successfully, but these errors were encountered: