@@ -0,0 +1,2232 @@
+import os%0Aimport subprocess%0A%0Afrom webassets.exceptions import FilterError%0A%0Afrom .sass import Sass%0A%0A%0A__all__ = ('NodeSass', )%0A%0A%0Aclass NodeSass(Sass):%0A    name = 'node-sass'%0A    options = %7B%0A        'binary': 'SASS_BIN',%0A        'debug_info': 'SASS_DEBUG_INFO',%0A        'use_scss': ('scss', 'SASS_USE_SCSS'),%0A        'as_output': 'SASS_AS_OUTPUT',%0A        'load_paths': 'SASS_LOAD_PATHS',%0A        'style': 'SASS_STYLE',%0A    %7D%0A    max_debug_level = None%0A%0A    def _apply_sass(self, _in, out, cd=None):%0A        # Switch to source file directory if asked, so that this directory%0A        # is by default on the load path. We could pass it via --include-paths, but then%0A        # files in the (undefined) wd could shadow the correct files.%0A        old_dir = os.getcwd()%0A        if cd:%0A            os.chdir(cd)%0A%0A        try:%0A            args = %5Bself.binary or 'node-sass',%0A                    '--output-style', self.style or 'expanded'%5D%0A%0A            if not self.use_scss:%0A                args.append(%22--indented-syntax%22)%0A%0A            if (self.ctx.environment.debug if self.debug_info is None else self.debug_info):%0A                args.append('--debug-info')%0A            for path in self.load_paths or %5B%5D:%0A                args.extend(%5B'--include-path', path%5D)%0A%0A            proc = subprocess.Popen(args,%0A                                    stdin=subprocess.PIPE,%0A                                    stdout=subprocess.PIPE,%0A                                    stderr=subprocess.PIPE,%0A                                    # shell: necessary on windows to execute%0A                                    # ruby files, but doesn't work on linux.%0A                                    shell=(os.name == 'nt'))%0A            stdout, stderr = proc.communicate(_in.read().encode('utf-8'))%0A%0A            if proc.returncode != 0:%0A                raise FilterError(('sass: subprocess had error: stderr=%25s, '+%0A                                   'stdout=%25s, returncode=%25s') %25 (%0A                                                stderr, stdout, proc.returncode))%0A            elif stderr:%0A                print(%22node-sass filter has warnings:%22, stderr)%0A%0A            out.write(stdout.decode('utf-8'))%0A        finally:%0A            if cd:%0A                os.chdir(old_dir)%0A

Implement a NodeSass filter