less / less.js

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

fix: change keyword plugin and import regexp #3668

Closed iChenLei closed 2 years ago

iChenLei commented 2 years ago

Try to fix https://github.com/less/less.js/issues/3660

We discovered that the regex used for import and plugin have a ? at the end of them, which means @plugi and @impor work as well as @plugin and @import. These are defined here: https://github.com/less/less.js/blob/master/packages/less/src/less/parser/parser.js#L1687 and https://github.com/less/less.js/blob/master/packages/less/src/less/parser/parser.js#L1847. This doesn't look like an intentional decision and more of a regex mistake. See here for example inputs: https://regex101.com/r/NUw7E2/2 Is this correct? --from @edhgoose

https://github.com/less/less.js/blob/a4b6c8544c077a193a3d39955db76047545f1539/packages/less/src/less/parser/parser.js#L1687

https://github.com/less/less.js/blob/a4b6c8544c077a193a3d39955db76047545f1539/packages/less/src/less/parser/parser.js#L1847

ready for code review, cc @matthew-dean . btw, i add .DS_Store into .gitignore