Skip to content

Commit

Permalink
Switch back to pyScss, and use it correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
funkybob committed Mar 7, 2017
1 parent 658bae2 commit 50da86c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions graaf/scss.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import os

import sass
from scss.compiler import Compiler

from .base import Generator

Expand All @@ -16,21 +16,21 @@ def __init__(self, include_paths=None, include_source=True, minify=True):
self.minify = minify

def can_process(self, filename):
return super(SassGenerator, self).can_process(filename) and not filename.startswith('_')
return (
super(SassGenerator, self).can_process(filename) and
not filename.startswith('_')
)

def process(self, root, dest_dir, filename, processor):
def process(self, src_dir, dest_dir, filename, processor):
basename, ext = os.path.splitext(filename)

include_paths = self.include_paths
if self.include_source:
include_paths.append(processor.srcdir)

with open(os.path.join(root, filename)) as fin:
with open(os.path.join(dest_dir, basename + '.css'), 'w') as fout:
fout.write(sass.compile_string(
fin.read(),
include_paths=include_paths[0],
output_style=sass.SASS_STYLE_COMPRESSED if self.minify else sass.SASS_STYLE_NESTED,
))
scss_source = self.read_file(src_dir, filename)
compiler = Compiler(search_path=include_paths)
content = compiler.compile_string(scss_source)
self.write_file(dest_dir, basename + '.css', content)

return True
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
'stencil-template',
'Markdown',
'pyyaml',
'sass',
'pyScss',
],
scripts=['scripts/graaf'],
)

0 comments on commit 50da86c

Please sign in to comment.