Zaheer Ahmad
Zaheer Ahmad

Reputation: 176

How to Pass separate file from view in Handlebar JS?

I facing issue while using handlebar.JS my issue is pretty simple but i can't get the solution :)

**Issue:**How I can pass the JS or CSS file in footer or header partial in Handlebar.JS

More Detail of My Existing Issue

In footer I have change .js file for each page like for home page i have 6 .js files and in user page I have 8 .js file also its change from home page so in this case how can i add these .js file in my footer partial

I have one layout in Handlebar.JS

<body>
{{>header}}
{{body}}
{{>footer}}
</body>

I create header and footer partials and all .js files in footer now issue is I need to add one specific file from {{body}} view that will render in my {{>footer}} partial.

Is it possible if yes then how can i archive my objective?

Upvotes: 1

Views: 88

Answers (1)

Zlatko
Zlatko

Reputation: 19578

You can pass parameters there, something like this:

{{ > footer paramName='something.js' }}

// then your footer partial has it:
{{ paramName }}

And you can render it as a script tag or script src or what you need.

Upvotes: 1

Related Questions