diff options
author | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2014-08-24 12:17:30 -0700 |
---|---|---|
committer | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2014-08-24 12:59:42 -0700 |
commit | c486c4ffe05f480fc1286c12f38e72d4c2b7ec1b (patch) | |
tree | a9a5c67a9972711d21ae0c6edf473c3dd1060460 /scss/tool.py | |
parent | 9230b03f0c62b3355ac32b8c1af8eff792f8edcb (diff) | |
download | pyscss-c486c4ffe05f480fc1286c12f38e72d4c2b7ec1b.tar.gz |
Clean up @import and SourceFile.
Real files are now identified by their absolute path at all times. Fake
files are expected to provide some other unique identifier.
Importing now explicitly checks that a found file is a descendant of one
of the search paths, so relative imports can finally work.
The spec rules for deciding when an import should compile to a CSS
@import have been (mostly) implemented.
Also, `@import "a.css", "b.css"` would spit out broken CSS; this is now
fixed.
Diffstat (limited to 'scss/tool.py')
-rw-r--r-- | scss/tool.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/scss/tool.py b/scss/tool.py index 4718c8d..cc5f191 100644 --- a/scss/tool.py +++ b/scss/tool.py @@ -176,14 +176,15 @@ def do_build(options, args): 'style': options.style, 'debug_info': options.debug_info, }) - if args: - source_files = [ - SourceFile.from_file(sys.stdin, "<stdin>", is_sass=options.is_sass) if path == '-' else SourceFile.from_filename(path, is_sass=options.is_sass) - for path in args - ] - else: - source_files = [ - SourceFile.from_file(sys.stdin, "<stdin>", is_sass=options.is_sass)] + if not args: + args = ['-'] + source_files = [] + for path in args: + if path == '-': + source = SourceFile.from_file(sys.stdin, "<stdin>", is_sass=options.is_sass) + else: + source = SourceFile.from_filename(path, is_sass=options.is_sass) + source_files.append(source) encodings = set(source.encoding for source in source_files) if len(encodings) > 1: @@ -322,7 +323,7 @@ class SassRepl(object): self.namespace = self.compiler.namespace self.compilation = self.compiler.make_compilation() self.legacy_compiler_options = {} - self.source_file = SourceFile.from_string('', '<shell>', line_numbers=False, is_sass=is_sass) + self.source_file = SourceFile.from_string('', '<shell>', is_sass=is_sass) self.calculator = Calculator(self.namespace) def __call__(self, s): |