Skip to content

Commit e09b2e8

Browse files
peterkroonmarijnh
authored andcommitted
Update lesscss mode.
1 parent 5e5152d commit e09b2e8

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

mode/less/index.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
<!doctype html>
32
<html>
43
<head>
@@ -15,6 +14,18 @@ <h1>CodeMirror: LESS mode</h1>
1514
<form><textarea id="code" name="code">
1615
/* Some LESS code */
1716

17+
video {
18+
background-image:url('paper.gif');
19+
}
20+
21+
.pre_class {
22+
width: 500px;
23+
height: 250px;
24+
background-image: url(sheep.png), url(betweengrassandsky.png);
25+
background-position: center bottom, left top;
26+
background-repeat: no-repeat;
27+
}
28+
1829
@color: #4D926F;
1930

2031
#header {

mode/less/less.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ CodeMirror.defineMode("less", function(config) {
5454
else if (/[;{}:\[\]()]/.test(ch)) { //added () char for lesscss original was [;{}:\[\]]
5555
if(ch == ":"){
5656
stream.eatWhile(/[active|hover|link|visited]/);
57-
if( stream.current().match(/[active|hover|link|visited]/)){
57+
if( stream.current().match(/active|hover|link|visited/)){
5858
return ret("tag", "tag");
5959
}else{
6060
return ret(null, ch);
@@ -93,6 +93,8 @@ CodeMirror.defineMode("less", function(config) {
9393
return ret("number", "unit");
9494
}else if( inTagsArray(stream.current()) ){ // lesscss match html tags
9595
return ret("tag", "tag");
96+
}else if( (stream.peek() == ")" || stream.peek() == "/") && stream.current().indexOf('.') !== -1){
97+
return ret("string", "string");//let url(logo.png) without quotes and froward slash return as string
9698
}else{
9799
return ret("variable", "variable");
98100
}

0 commit comments

Comments
 (0)