mirror of
https://github.com/less/less.js.git
synced 2026-01-09 15:48:08 -05:00
fix: change keyword plugin and import regexp (#3668)
* fix: change the and regexp match * feat: change unit test * chore: change desc
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -6,6 +6,7 @@
|
||||
.idea
|
||||
*.iml
|
||||
*.sublime-*
|
||||
.DS_Store
|
||||
|
||||
# npm
|
||||
node_modules
|
||||
|
||||
@@ -1684,7 +1684,7 @@ const Parser = function Parser(context, imports, fileInfo) {
|
||||
let features;
|
||||
const index = parserInput.i;
|
||||
|
||||
const dir = parserInput.$re(/^@import?\s+/);
|
||||
const dir = parserInput.$re(/^@import\s+/);
|
||||
|
||||
if (dir) {
|
||||
const options = (dir ? this.importOptions() : null) || {};
|
||||
@@ -1844,7 +1844,7 @@ const Parser = function Parser(context, imports, fileInfo) {
|
||||
let args;
|
||||
let options;
|
||||
const index = parserInput.i;
|
||||
const dir = parserInput.$re(/^@plugin?\s+/);
|
||||
const dir = parserInput.$re(/^@plugin\s+/);
|
||||
|
||||
if (dir) {
|
||||
args = this.pluginArgs();
|
||||
|
||||
1
packages/test-data/css/_main/impor.css
Normal file
1
packages/test-data/css/_main/impor.css
Normal file
@@ -0,0 +1 @@
|
||||
@impor "impor-typo-dont-parse-as-@import.less";
|
||||
1
packages/test-data/css/_main/plugi.css
Normal file
1
packages/test-data/css/_main/plugi.css
Normal file
@@ -0,0 +1 @@
|
||||
@plugi "plugi-typo-dont-parse-as-@plugin";
|
||||
5
packages/test-data/less/_main/impor.less
Normal file
5
packages/test-data/less/_main/impor.less
Normal file
@@ -0,0 +1,5 @@
|
||||
// https://github.com/less/less.js/issues/3660
|
||||
// const dir = parserInput.$re(/^@import?\s+/);
|
||||
// correct regexp is /^@import\s+/
|
||||
// so follow code will change nothing, parse result is same with raw less code
|
||||
@impor "impor-typo-dont-parse-as-@import.less";
|
||||
5
packages/test-data/less/_main/plugi.less
Normal file
5
packages/test-data/less/_main/plugi.less
Normal file
@@ -0,0 +1,5 @@
|
||||
// https://github.com/less/less.js/issues/3660
|
||||
// const dir = parserInput.$re(/^@plugin?\s+/);
|
||||
// correct regexp is /^@plugin\s+/
|
||||
// so follow code will change nothing, parse result is same with raw less code
|
||||
@plugi "plugi-typo-dont-parse-as-@plugin";
|
||||
Reference in New Issue
Block a user