Beispiel #1
0
 def test_cache(self):
     src = open(self.path).read()
     test = parser.parse(src)
     f = open(self.path)
     out = parser.load(f, precache=True)
     self.assertEqual(test, out)
     cached_out = parser.load(f, precache=True)
     self.assertEqual(test, cached_out)
Beispiel #2
0
 def test_cache(self):
     path = os.path.join(os.path.dirname(__file__), 'example.scss')
     src = open(path).read()
     test = parser.parse(src)
     out = parser.load(open(path), precache=True)
     self.assertEqual(test, out)
Beispiel #3
0
from scss import parser

# TODO: 
# pip install scss
# https://pythonhosted.org/scss/

file_path = path_to_file
src = open( file_path ).read()

# from file
print parser.load( 'file_path' )

# from string
print parser.parse( 'src' )

# Create parser object
p = parser.Stylesheet( options=dict( compress=True ) )
print p.loads( src )
p.load( file_path )
print p