collective / plonetheme.webpacktemplate

provides a mr.bob template to generate a webpack thema package for Plone
15 stars 3 forks source link

bootstrapPath var missing for mosaic #21

Open Gomez opened 4 years ago

Gomez commented 4 years ago

On Plone 5.2.1 this var is missing (not sure if on older versions too). Adding it in the web-ui as LESS-Variable fixed it. But i cant find where it should get added / get lost?

ERROR in ./src/lakof.theme/logged-in.less (./node_modules/css-loader/dist/cjs.js??ref--6-1!./node_modules/less-loader/dist/cjs.js??ref--6-2!./src/lakof.theme/logged-in.less)
Module build failed (from ./node_modules/less-loader/dist/cjs.js):

@import (reference) "@{barcelonetaPath}/less/variables.plone.less";
@import (reference) "@{bootstrapPath}/less/bootstrap.less";
                  ^
Variable @bootstrapPath is undefined
datakurre commented 4 years ago

@Gomez Did already found out where that import is? I was unable to find it. Usually missing variables have been bugs in Plone (and have also broken TTW resource bundle build in Plone).

Gomez commented 4 years ago

I think its mosaic specific, here is the commit.

Not sure how to fix, would updating the less-loader a option? Like this: https://stackoverflow.com/questions/52075144/import-global-variables-in-less-loader

Maybe could be done in the project webpack.config.js?

Gomez commented 4 years ago

Workaround is adding this to registry.xml:

<record name="plone.lessvariables">
  <value purge="false">
    <element key="bootstrapPath">\"{site_url}/++plone++static/components/bootstrap/\"</element>
  </value>
  </record>
datakurre commented 4 years ago

Thanks. That explains. If Mosaic does not have that, it is technically a bug in Mosaic (or maybe that variable did exist on the beginning).

You probably also already know that variables from Plone are cached under ./resources/.plone/

That said, we already have support for defining / overriding less variables https://github.com/jyukopla/reclas/blob/ea398faa04dfac5008332d7bbcecc4a8025ba00c/resources/webpack.config.js#L36