I have a 2 Pug files.
The first define config object (base.pug) object like below
const config = { name: 'abc', age: 25}
The other Pug template (main.pug) which includes base.pug and wants to additional property to an object.
script.
const base = {tech: 'js'}
const mergedObject = {config, base} // I supposed this should merge 2 object.
const mergedObjectWithSpreadOp = {...config, tech: 'js'} // again I supposed this should merge 2 object.
Note: pug-runtime used is 2.0.1
None of my approaches worked. How can I achieve this?
I want to merge object from base.pug with main.pug
<script>element client-side with that javascript written out? Or are you wanting to use a merged object server-side in Pug and don't care if it's output client-side?