Commit 31df862b by Timothée Peignier

change cwd for less and sass compiler

parent 5c421949
...@@ -68,9 +68,10 @@ class CompilerError(Exception): ...@@ -68,9 +68,10 @@ class CompilerError(Exception):
class SubProcessCompiler(CompilerBase): class SubProcessCompiler(CompilerBase):
def execute_command(self, command, content=None): def execute_command(self, command, content=None, cwd=None):
pipe = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, pipe = subprocess.Popen(command, shell=True, cwd=cwd,
stdin=subprocess.PIPE, stderr=subprocess.PIPE) stdout=subprocess.PIPE, stdin=subprocess.PIPE,
stderr=subprocess.PIPE)
if content: if content:
pipe.stdin.write(content) pipe.stdin.write(content)
......
import os.path
from pipeline.conf import settings from pipeline.conf import settings
from pipeline.compilers import SubProcessCompiler from pipeline.compilers import SubProcessCompiler
...@@ -14,5 +16,6 @@ class LessCompiler(SubProcessCompiler): ...@@ -14,5 +16,6 @@ class LessCompiler(SubProcessCompiler):
settings.PIPELINE_LESS_ARGUMENTS, settings.PIPELINE_LESS_ARGUMENTS,
path path
) )
content = self.execute_command(command) cwd = os.path.dirname(path)
content = self.execute_command(command, cwd=cwd)
return content return content
import os.path
from pipeline.conf import settings from pipeline.conf import settings
from pipeline.compilers import SubProcessCompiler from pipeline.compilers import SubProcessCompiler
...@@ -14,4 +16,5 @@ class SASSCompiler(SubProcessCompiler): ...@@ -14,4 +16,5 @@ class SASSCompiler(SubProcessCompiler):
settings.PIPELINE_SASS_ARGUMENTS, settings.PIPELINE_SASS_ARGUMENTS,
path path
) )
return self.execute_command(command) cwd = os.path.dirname(path)
return self.execute_command(command, cwd=cwd)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment