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

Handlebars is tightly coupled #253

Open
jscharett opened this issue Aug 16, 2016 · 2 comments
Open

Handlebars is tightly coupled #253

jscharett opened this issue Aug 16, 2016 · 2 comments

Comments

@jscharett
Copy link

Looking at the doc, it states that you can use 'handlebarsPath' to specify the path to a different version of handlebars. However, looking at the hbs plugin, it requires 'hbs/handlebars'. It only seems to use the handlebarsPath when compiling the templates. In order for me to truly use a different version of handlebars, I need to set of a path in my require.config to point to the new version. Would be nice if the plugin could handle this for me in some fashion, so I don't need to specify 2 paths to handlebars in my config.

@prantlf
Copy link

prantlf commented Mar 5, 2017

Currently all dependencies are required immediately in the main define function of the hbs module. The plugin configuration is not accessible there yet. That's why the config.hbs.handlebarsPath setting, which gets applied during the build later in the module, affects only the compile phase.

Workarounds:

  1. Define alias for "hbs/handlebars" pointing to your own module path by require.config().
  2. Replace "hbs/handlebars" in this module by your own module path.
  3. Rewrite this module, so that it requires dependencies when the load method of the plugin gets called. You will have access to config.hbs.handlebarsPath then.

@neetusn
Copy link

neetusn commented Jan 17, 2021

completely new to this package and trying to upgrade the existing legacy code with below config,

require.config({
baseUrl: "./js",
paths: {
hbs: 'libraries/hbs/hbs',
......
},
hbs: { // optional
helpers: true, // default: true
i18n: false, // default: false
templateExtension: 'tmpl', // default: 'hbs'
partialsUrl: '', // default: ''
},shim: {
mxG: {
exports: 'mxGraph',
deps: ['mxGConfig', 'override']
},
jqueryactual: {
exports: 'jqueryactual',
deps: ['jquery-external']
},
uniform: {
deps: ['jquery-external']
},
datatables: {
deps: ['jquery-external']
},
toolbarRenderer: {
deps: ['uniform']
},
menuManager: {
deps: ['menu', 'menuItem']
},
renderManager: {
deps: ['promise', 'canvasToBlob']
},
html2canvas: {
exports: 'html2canvas'
},
graphRenderer: {
deps: ['jqueryactual']
},
canvg: {
exports: 'canvg'
},
filesaver: {
exports: 'saveAs'
},
handlebars: {
exports: 'Handlebars'
}
}

and I need to upgrade the current hbs/hbs/handlebars.js -> v1.3.0 to v4.7.6

no luck with this approach, need your help for the same

Thanks in advance

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

No branches or pull requests

3 participants