def test_exception_for_margin_identation(self): in_sass = """ a font: family: Helvetica #new_class """ out_css = sassin.compile(in_sass)
def test_exception_for_misaligned_identation(self): in_sass = """ a font: family: Helvetica weight: bold """ out_css = sassin.compile(in_sass)
def test_import(self): in_sass = """ @import test-import.sass """ out_css = sassin.compile(in_sass) out_lines = splitlines(out_css) test_css = """ body { background-color: #EEE; } """ test_lines = splitlines(test_css) eq_(out_lines, test_lines)
def test_line_continuation(self): in_sass = """ #container, #article_container, #sidebar_container, #footer_container, #useless_container background-color: #DDD """ out_css = sassin.compile(in_sass) out_lines = splitlines(out_css) test_css = """ #container, #article_container, #sidebar_container, #footer_container, #useless_container { background-color: #DDD; } """ test_lines = splitlines(test_css) eq_(out_lines, test_lines)
def test_indent(self): in_sass = """ a font: family: Helvetica """ out_css = sassin.compile(in_sass) out_lines = splitlines(out_css) test_css = """ a { font: { family: Helvetica; } } """ test_lines = splitlines(test_css) eq_(out_lines, test_lines)
def test_comment(self): in_sass = """ /* comment body /* comment background-color: white """ out_css = sassin.compile(in_sass) out_lines = splitlines(out_css) test_css = """ /* comment */ body { /* comment */ background-color: white; } """ test_lines = splitlines(test_css) eq_(out_lines, test_lines)
def scss_to_css(src, dst_dir, site): dst = os.path.join(dst_dir, os.path.basename(src)) dst = os.path.splitext(dst)[0] + '.css' if not has_extensions(src, '.sass', '.scss'): return False if not site['force'] and is_uptodate(src, dst): return False if has_extensions(src, '.sass'): sass_text = read_text(src) scss_text = sassin.compile(sass_text) else: scss_text = read_text(src) try: css_text = _scss_compiler.compile(scss_text) if os.path.isfile(dst): os.remove(dst) write_text(dst, css_text) logger.info('compiled .sass file: "{0}" -> "{1}"'.format(src, dst)) except Exception, e: logger.error('sassin:in "{0}"'.format(src)) logger.error('sassin:' + str(e))