I feel like an idiot asking this, but I've been trying to solve this for hours now.
For a plugin, I want to add styling depending on a config setting, in this case showWindowControls.
So if this is set to 'left', I want some different style added.
My attempt so far:
exports.decorateConfig = (config) => {
const controlLeft = config.showWindowControls;
// main styling
return Object.assign({}, config, {
css: `
${config.css || ''}
[...]
`
})
if(controlLeft == 'left') {
// add some more css if `showWindowControls` is set to `'left'`
return Object.assign({}, config, {
css: `
${config.css || ''}
[...]
`
})
}
}
Any tips to get me in the right direction?
I think you just need to move this block if(controlLeft == 'left') {to be above the first return:
exports.decorateConfig = (config) => {
const controlLeft = config.showWindowControls;
if(controlLeft == 'left') {
// add some more css if `showWindowControls` is set to `'left'`
return Object.assign({}, config, {
css: `
${config.css || ''}
[...]
`
})
}
// main styling
return Object.assign({}, config, {
css: `
${config.css || ''}
[...]
`
})
}
Let me know if that was it 馃憤 Otherwise I'll dig deeper 馃檶
Thanks, that worked!