less 0.8.6 → 0.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +2 -2
- data/VERSION +1 -1
- data/less.gemspec +2 -2
- data/lib/less.rb +3 -3
- data/lib/less/command.rb +14 -6
- data/lib/less/engine.rb +4 -4
- data/lib/less/tree.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -20,8 +20,8 @@ LESS allows you to write CSS the way (I think) it was meant to, that is: with *v
|
|
20
20
|
### And the CSS output it produces:
|
21
21
|
|
22
22
|
.outline { border: 1px solid black }
|
23
|
-
.article
|
24
|
-
.article
|
23
|
+
.article a { text-decoration: none }
|
24
|
+
.article p { color: #110011 }
|
25
25
|
.article { border: 1px solid black }
|
26
26
|
|
27
27
|
If you have CSS nightmares, just
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.7
|
data/less.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{less}
|
5
|
-
s.version = "0.8.
|
5
|
+
s.version = "0.8.7"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["cloudhead"]
|
9
|
-
s.date = %q{2009-06-
|
9
|
+
s.date = %q{2009-06-15}
|
10
10
|
s.default_executable = %q{lessc}
|
11
11
|
s.description = %q{LESS is leaner CSS}
|
12
12
|
s.email = %q{alexis@cloudhead.net}
|
data/lib/less.rb
CHANGED
@@ -4,9 +4,9 @@ require 'less/command'
|
|
4
4
|
require 'less/engine'
|
5
5
|
require 'less/tree'
|
6
6
|
|
7
|
-
module Less
|
8
|
-
|
9
|
-
|
7
|
+
module Less
|
8
|
+
MixedUnitsError = Class.new(Exception)
|
9
|
+
PathError = Class.new(Exception)
|
10
10
|
|
11
11
|
def self.version
|
12
12
|
File.read( File.join( File.dirname(__FILE__), '..', 'VERSION') )
|
data/lib/less/command.rb
CHANGED
@@ -21,6 +21,8 @@ module Less
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def run!
|
24
|
+
compile(true) unless File.exist? @destination
|
25
|
+
|
24
26
|
if watch?
|
25
27
|
log "Watching for changes in #@source ...Ctrl-C to abort.\n"
|
26
28
|
|
@@ -44,7 +46,7 @@ module Less
|
|
44
46
|
end
|
45
47
|
end
|
46
48
|
|
47
|
-
def compile
|
49
|
+
def compile new = false
|
48
50
|
begin
|
49
51
|
# Create a new Less object with the contents of a file
|
50
52
|
css = Less::Engine.new( File.read( @source ) ).to_css @options[:inheritance]
|
@@ -53,16 +55,18 @@ module Less
|
|
53
55
|
File.open( @destination, "w" ) do |file|
|
54
56
|
file.write css
|
55
57
|
end
|
56
|
-
puts " [Updated] #{@destination.split('/').last}" if watch?
|
58
|
+
puts "#{new ? '* [Created]' : ' [Updated]'} #{@destination.split('/').last}" if watch?
|
57
59
|
rescue Errno::ENOENT => e
|
58
60
|
abort "#{e}"
|
59
61
|
rescue SyntaxError
|
60
62
|
error = debug?? $! : $!.message.split("\n")[1..-1].collect {|e|
|
61
63
|
e.gsub(/\(eval\)\:(\d+)\:\s/, 'line \1: ')
|
62
64
|
} * "\n"
|
63
|
-
|
64
|
-
rescue MixedUnitsError
|
65
|
-
|
65
|
+
err "errors were found in the .less file! \n#{error}\n"
|
66
|
+
rescue MixedUnitsError => e
|
67
|
+
err "`#{e}` you're mixing units together! What do you expect?\n"
|
68
|
+
rescue PathError => e
|
69
|
+
err "`#{e}` was not found.\n"
|
66
70
|
else
|
67
71
|
true
|
68
72
|
end
|
@@ -70,7 +74,11 @@ module Less
|
|
70
74
|
|
71
75
|
# Just a logging function to avoid typing '}'
|
72
76
|
def log s = ''
|
73
|
-
print '
|
77
|
+
print '* ' + s.to_s
|
78
|
+
end
|
79
|
+
|
80
|
+
def err s = ''
|
81
|
+
print "!! #{s}"
|
74
82
|
end
|
75
83
|
end
|
76
84
|
end
|
data/lib/less/engine.rb
CHANGED
@@ -85,7 +85,7 @@ module Less
|
|
85
85
|
next if operation.match /[a-z]/i
|
86
86
|
evaluate.call operation
|
87
87
|
else
|
88
|
-
raise MixedUnitsError
|
88
|
+
raise MixedUnitsError, value
|
89
89
|
end
|
90
90
|
end
|
91
91
|
end
|
@@ -106,9 +106,9 @@ module Less
|
|
106
106
|
end
|
107
107
|
|
108
108
|
if var
|
109
|
-
node[ key ] = value.gsub REGEX[:path], var
|
109
|
+
node[ key ] = value.gsub REGEX[:path], var # Substitute variable with value
|
110
110
|
else
|
111
|
-
node.delete key
|
111
|
+
node.delete key # Discard the declaration if the variable wasn't found
|
112
112
|
end
|
113
113
|
end
|
114
114
|
end
|
@@ -126,7 +126,7 @@ module Less
|
|
126
126
|
# less: color: black;
|
127
127
|
# hashify: "color" => "black"
|
128
128
|
#
|
129
|
-
hash = self.gsub(/\t
|
129
|
+
hash = self.gsub(/\t+/, ' '). # Tabs
|
130
130
|
gsub(/\r\n/, "\n"). # m$
|
131
131
|
gsub(/\/\/.*/, ''). # Comments //
|
132
132
|
gsub(/\/\*.*?\*\//m, ''). # Comments /*
|
data/lib/less/tree.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: less
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- cloudhead
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-06-
|
12
|
+
date: 2009-06-15 00:00:00 -04:00
|
13
13
|
default_executable: lessc
|
14
14
|
dependencies: []
|
15
15
|
|