nonoroazoro / docusaurus-plugin-less

Provides support for Less to Docusaurus 2
https://www.npmjs.com/package/docusaurus-plugin-less
MIT License
5 stars 6 forks source link

Enable inline javascript #1

Open pmkrawczyk opened 3 years ago

pmkrawczyk commented 3 years ago

Hi,

I'm trying to enable inline javascript in less by adding the following to docusaurus.config.js:

plugins: [
    ["docusaurus-plugin-sass", {}],
    [
      require.resolve("docusaurus-plugin-less"),
      {
        lessOptions: {
          javascriptEnabled: true,
        },
      },
    ],
  ],

But this does not work, inline javascript throws errors.

By the way, while looking through the plugin code I found this:

const AVAILABLE_LOADER_OPTION_KEYS = [
    'lessOption',
    'additionalData',
    'sourceMap',
    'webpackImporter'
];

As far as I can see, the key should be 'lessOptions' (plural). Changing this does not solve my problem though...

Can anyone help, please?

nonoroazoro commented 3 years ago

Can you paste your code (including less) here?

pmkrawczyk commented 3 years ago

Thank you for your help!

The less file comes from the RSuite, I am trying to import the steps component into docusaurus.

The component imports properly but when I try to import styles using this command: import "rsuite/lib/Steps/styles";

I get the following error:

.tinyColorMixin();
^
Inline JavaScript is not enabled. Is it set in your options?
      in node_modules\rsuite\lib\styles\mixins\tiny-color.less (line 1183, column 0)

The error is thrown by this command: .tinyColorMixin(); in this less file.

Is this sufficient information (I'm quite a noob at this!)

nonoroazoro commented 3 years ago

@pmkrawczyk Please use the following code to set less-loader options:

plugins: [
    [
      "docusaurus-plugin-less",
      { lessOptions: { javascriptEnabled: true } }
    ]
  ],
pmkrawczyk commented 3 years ago

Yes, I've tried this syntax as well, I'm afraid ti doesn't work either - I always get the mentioned errors...

nonoroazoro commented 3 years ago

It works in my project, weird...

yijinc commented 2 years ago

i have the same error 😥