less / less.js

Less. The dynamic stylesheet language.
http://lesscss.org
Apache License 2.0
17.02k stars 3.41k forks source link

fix(#3294): use loadFileSync when loading plugins with syncImport: true #3506

Closed Justineo closed 4 years ago

Justineo commented 4 years ago

Currently the only way to compile Less code synchronously is by setting syncImport: true. But as described in #3294, it cannot work when it involves plugins. In fact loadPlugin didn't have a sync version. This PR added a loadPluginSync method to fix this problem.


PS. I didn't quite understand how tests work so tests are not included. Any help would be appreciated.


Please note: compiled files are not included in this PR.

Justineo commented 4 years ago

I've added some tests (including a regression test for import mentioned in https://github.com/less/less.js/issues/3294#issuecomment-407108658).

@matthew-dean It would be very appreciated if you can take a look at this when you have time :)

matthew-dean commented 4 years ago

Thanks!

Justineo commented 4 years ago

Hi @matthew-dean, could you please release a new version when you have time? (I'm actually waiting for this feature to be shipped so that I can use Less plugins in a project based on vite, which only supports sync mode ATM). Thanks!