diff options
author | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2014-11-12 17:47:10 -0800 |
---|---|---|
committer | Eevee (Alex Munroe) <eevee.git@veekun.com> | 2014-11-12 17:47:10 -0800 |
commit | 0aa13e835f3f356a0a435d40b885e68c76ed92d8 (patch) | |
tree | a38b6ba5af975cf8498f52f9d3c282bb9fd434e1 | |
parent | d4c74c5ddf65277bd5ce77b44c7f921b79413f6d (diff) | |
download | pyscss-0aa13e835f3f356a0a435d40b885e68c76ed92d8.tar.gz |
Add Compiler.compile_sources.
-rw-r--r-- | scss/compiler.py | 8 | ||||
-rw-r--r-- | scss/source.py | 6 |
2 files changed, 13 insertions, 1 deletions
diff --git a/scss/compiler.py b/scss/compiler.py index 82c5390..551f407 100644 --- a/scss/compiler.py +++ b/scss/compiler.py @@ -195,6 +195,14 @@ class Compiler(object): compilation.add_source(source) return self.call_and_catch_errors(compilation.run) + def compile_sources(self, *sources): + # TODO this api is not the best please don't use it. this all needs to + # be vastly simplified, still, somehow. + compilation = self.make_compilation() + for source in sources: + compilation.add_source(source) + return self.call_and_catch_errors(compilation.run) + def compile_string(self, string): source = SourceFile.from_string(string) compilation = self.make_compilation() diff --git a/scss/source.py b/scss/source.py index a3725f8..7f99c1f 100644 --- a/scss/source.py +++ b/scss/source.py @@ -5,7 +5,6 @@ from __future__ import division import hashlib import logging -import os from pathlib import Path import re @@ -43,6 +42,11 @@ class MISSING(object): MISSING = MISSING() +# TODO i'm still not entirely happy with this, nor with the concept of an +# "origin". it should really be a "loader", with a defined API. also, even +# with all these helpful classmethods, i'm still having to do a lot of manual +# mucking around in django-pyscss, where all i'm given is a file path and a +# string of the contents, and i want to /not/ re-read the file. class SourceFile(object): """A single input file to be fed to the compiler. Detects the encoding (according to CSS spec rules) and performs some light pre-processing. |