示例#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)
示例#2
0
文件: __init__.py 项目: booo/gid
def css(name):
   import os
   from scss import parser
   
   path = os.path.join(__name__, 'static', 'css', name) + '.sass'
   if os.path.exists(path):
      return Response(parser.load(path)) 

   return Response(""), 404
示例#3
0
def getScript(name=''):
	response.content_type = 'text/css'

	path = 'web/styles/' + name
	sassPath = re.sub('.css', '.scss', path)
	if os.path.isfile(path):
		return static_file(name, 'web/styles/')
	elif os.path.isfile(sassPath):
		return parser.load(sassPath)
	abort(404)
示例#4
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)
示例#5
0
文件: danzig.py 项目: jibasig/danzig
def compileCss():
    """Compile scss file from templates directory"""
    template = app.config['TEMPLATE']
    compiled = open(app.config['CSS'], 'w')
    compiled.write(parser.load(template))
示例#6
0
def scss_interpreter(file):
    return scss_parser.load(file)
示例#7
0
def scss_interpreter(file):
    return scss_parser.load(file)
 def compileScss(self):
     with open(os.path.join(self.outdir, "style.css"), "w") as output:
         scssPath = os.path.join(template_dir, 'style.scss')
         #print scssPath
         parsedScss = parser.load(scssPath)
         output.write(parsedScss)
示例#9
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
 def compileScss(self):
     with open(os.path.join(self.outdir ,"style.css"), "w") as output:
         scssPath = os.path.join(template_dir,'style.scss')
         #print scssPath
         parsedScss = parser.load(scssPath)
         output.write(parsedScss)