less.js icon indicating copy to clipboard operation
less.js copied to clipboard

less with @import on main thread - Chrome > 101

Open Karthiga218 opened this issue 3 years ago • 5 comments

To reproduce:

<html>
<head>
<style  type="text/less"> 
 @import "test.less";
</style> 
<script src="less.js"></script>

<script>
console.log("script resumed at main page");
<script>
</head>
<body>
test
</body>
</html>

// less code here test.css

body {
 background-color: red;
}

Current behavior:

Chrome version > 101 - after less imports the test.less - the control never comes back to main page to continue the processing Chrome version < 101 - Everything works well

Environment information:

Tested with all versions of less to same result.

Karthiga218 avatar May 12 '22 22:05 Karthiga218

You make wrong script tag. 屏幕截图 2022-05-26 200437 You make this. <script> console.log("script resumed at main page"); </script>

lumburr avatar May 26 '22 12:05 lumburr

I have the same issue: @import within

No wrong script tag on my page :-)

Cybso avatar May 31 '22 15:05 Cybso

More information:

This fails:

<style media="screen" type="text/less">
@fontSize: 12px;
@import url(/css/default/styles.less);
</style>


<style media="screen" type="text/less">
@import url(/css/default/login.less);
</style>

But this works fine:

<style media="screen" type="text/less">
@fontSize: 12px;
@import url(/css/default/styles.less);
@import url(/css/default/login.less);
</style>

And this is working, too:

<style media="screen" type="text/less">
@import url(/css/default/styles.less);
</style>


<style media="screen" type="text/less">
@import url(/css/default/login.less);
</style>

The content of the .less files don't matter, in this test they were completely empty.

Cybso avatar May 31 '22 16:05 Cybso

The issue also occurs if the page content is replaced by JavaScript and the new content contains another

Cybso avatar May 31 '22 17:05 Cybso

To make it even worse it seems that the problem is also triggered when the second imported less file itself contains variable definitions.

Cybso avatar May 31 '22 17:05 Cybso