I'm trying to pass less variables within a webpack configuration to the less loader, naturally. For some reason the variable is not being passed ok. I can't figure the correct syntax.
The variable has a dynamic content that is determined at the build time, in the webpack config file. This is the relevant line (I've tried many variations of it):
loader: 'style!css?-minimize!less?-minimize&{modifyVars:{"resources-path-prefix":"' + pathPrefix + '"}}'
In the above example some pathPrefix is being determined at build time and we want to pass its value into less context, where it will be used in url() css directives.
The above doesn't work - nothing is passed into less, and the default variable value defined in less applies.
Can anyone show how to correctly pass the value into the less compilation process? Thanks!
@resources-path-prefix
orresources-path-prefix
? I think you are missing the@
which is expected inmodifyVars
.