Permalink
Browse files

renamed LESS_SOURCE_PATHS to LESS_LOAD_PATH and made it a $global, as…

… it is meant to be modified
  • Loading branch information...
1 parent e46d98c commit bedacd30d3fac786dbaf872d03c74b85395728d2 cloudhead committed Dec 10, 2009
Showing with 4 additions and 7 deletions.
  1. +2 −1 lib/less.rb
  2. +1 −2 lib/less/engine/grammar/less.tt
  3. +1 −4 spec/engine_spec.rb
View
@@ -6,7 +6,8 @@
LESS_ROOT = File.expand_path(File.dirname(__FILE__))
LESS_PARSER = File.join(LESS_ROOT, 'less', 'engine', 'parser.rb')
LESS_GRAMMAR = File.join(LESS_ROOT, 'less', 'engine', 'grammar')
-LESS_SOURCE_PATHS = []
+
+$LESS_LOAD_PATH = []
$:.unshift File.dirname(__FILE__)
@@ -126,7 +126,7 @@ module Less
standard_path = File.join(env.root.file || Dir.pwd, url.value)
# Compile a list of possible paths for this file
- paths = LESS_SOURCE_PATHS.map { |p| File.join(p, url.value) } + [standard_path]
+ paths = $LESS_LOAD_PATH.map { |p| File.join(p, url.value) } + [standard_path]
# Standardize and make uniq
paths = paths.map do |p|
p = File.expand_path(p)
@@ -136,7 +136,6 @@ module Less
# Use the first that exists if any
if path = paths.detect {|p| File.exists?(p)}
- puts "importing from path #{path}"
unless env.root.imported.include?(path)
env.root.imported << path
env.rules += Less::Engine.new(File.new(path)).to_tree.rules
View
@@ -113,12 +113,9 @@ def add a, b
lessify(:import_with_extra_paths).should == css(:import_with_extra_paths)
}.should raise_error(Less::ImportError)
# finding a partial in another location
- LESS_SOURCE_PATHS = ["spec/less/extra_import_path"]
+ $LESS_LOAD_PATH = ["spec/less/extra_import_path"]
lessify(:import_with_extra_paths).should == css(:import_with_extra_paths)
# overriding a partial in another location so this takes priority over the same named partial in the same directory
- puts '-'
- puts '-'
- puts '-'*100
lessify(:import).should == css(:import_with_partial_in_extra_path)
end

2 comments on commit bedacd3

@kematzy

Line 7 in lib/less.rb points to a non-existant file.

LESS_PARSER = File.join(LESS_ROOT, 'less', 'engine', 'parser.rb')

Is this file missing from the commit, or just an code oversight?

@cloudhead
Member

The file's existance is optional — it's the compiled parser. If it isn't found, Less will just compile it on the fly. I haven't found much of a speed difference in having it precompiled, so I make it optional.

Please sign in to comment.