less 0.8.3 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/lessc +6 -1
- data/less.gemspec +1 -1
- data/lib/less/command.rb +4 -1
- data/lib/less/engine.rb +5 -3
- data/spec/spec.less +12 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.4
|
data/bin/lessc
CHANGED
@@ -10,7 +10,8 @@ CSS = '.css'
|
|
10
10
|
# Argument defaults
|
11
11
|
options = {
|
12
12
|
:watch => false,
|
13
|
-
:compress => false
|
13
|
+
:compress => false,
|
14
|
+
:debug => false
|
14
15
|
}
|
15
16
|
|
16
17
|
# Get arguments
|
@@ -36,6 +37,10 @@ opts = OptionParser.new do |o|
|
|
36
37
|
puts opts
|
37
38
|
exit
|
38
39
|
end
|
40
|
+
|
41
|
+
o.on_tail("-d", "--debug", "show full error messages") do
|
42
|
+
options[:debug] = true
|
43
|
+
end
|
39
44
|
|
40
45
|
# Version
|
41
46
|
o.on_tail("-v", "--version", "show version") do
|
data/less.gemspec
CHANGED
data/lib/less/command.rb
CHANGED
@@ -7,6 +7,7 @@ module Less
|
|
7
7
|
|
8
8
|
def watch?() @options[:watch] end
|
9
9
|
def compress?() @options[:compress] end
|
10
|
+
def debug?() @options[:debug] end
|
10
11
|
|
11
12
|
# little function which allows us to
|
12
13
|
# Ctrl-C exit inside the passed block
|
@@ -56,7 +57,9 @@ module Less
|
|
56
57
|
rescue Errno::ENOENT => e
|
57
58
|
abort "#{e}"
|
58
59
|
rescue SyntaxError
|
59
|
-
error = $!.message.split("\n")[1..-1].collect {|e|
|
60
|
+
error = debug?? $! : $!.message.split("\n")[1..-1].collect {|e|
|
61
|
+
e.gsub(/\(eval\)\:(\d+)\:\s/, 'line \1: ')
|
62
|
+
} * "\n"
|
60
63
|
log " !! errors were found in the .less file! \n#{error}\n"
|
61
64
|
rescue MixedUnitsError
|
62
65
|
log "!! You're mixing units together! what do you expect?\n"
|
data/lib/less/engine.rb
CHANGED
@@ -126,13 +126,15 @@ module Less
|
|
126
126
|
# less: color: black;
|
127
127
|
# hashify: "color" => "black"
|
128
128
|
#
|
129
|
-
hash = self.gsub(
|
129
|
+
hash = self.gsub(/\t/, ' '). # Tabs
|
130
|
+
gsub(/\r\n/, "\n"). # m$
|
131
|
+
gsub(/\/\/.*/, ''). # Comments //
|
130
132
|
gsub(/\/\*.*?\*\//m, ''). # Comments /*
|
131
133
|
gsub(/"/, "'"). # " => '
|
132
134
|
gsub(/("|')(.+?)(\1)/) { $1 + CGI.escape( $2 ) + $1 }. # Escape string values
|
133
|
-
gsub(/(#{REGEX[:property]})
|
135
|
+
gsub(/(#{REGEX[:property]}):\s*(.+?)\s*(;|(?=\}))/,'"\1"=>"\2",'). # Rules
|
134
136
|
gsub(/\}/, "},"). # Closing }
|
135
|
-
gsub(/(
|
137
|
+
gsub(/( *)(#{REGEX[:selector]}+?)[ \n]*(?=\{)/m, '\1"\2"=>'). # Selectors
|
136
138
|
gsub(/([.#][->\w .#]+);/, '"\\1" => :mixin,') # Mixins
|
137
139
|
eval "{" + hash + "}" # Return {hash}
|
138
140
|
end
|
data/spec/spec.less
CHANGED
@@ -94,9 +94,17 @@ ul li:first-child, ul li:last-child {
|
|
94
94
|
.p:first-letter {
|
95
95
|
color: red;
|
96
96
|
}
|
97
|
+
:focus {
|
98
|
+
outline: 0;
|
99
|
+
content: "*}#f~ ";
|
100
|
+
}
|
97
101
|
q:lang(no) {
|
98
102
|
quotes: "~" "~";
|
99
103
|
}
|
104
|
+
blockquote:before {
|
105
|
+
color: red;
|
106
|
+
}
|
107
|
+
|
100
108
|
/*input[type="text"] {
|
101
109
|
background-color: blue;
|
102
110
|
}*/
|
@@ -108,4 +116,7 @@ q:lang(no) {
|
|
108
116
|
|
109
117
|
// Spacing
|
110
118
|
.space
|
111
|
-
{ color: purple ;font-color:yellow; }
|
119
|
+
{ color: purple ;font-color:yellow; }
|
120
|
+
|
121
|
+
// No semi-column
|
122
|
+
.no-semi-column { color: orange }
|