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)
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
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)
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)
def compileCss(): """Compile scss file from templates directory""" template = app.config['TEMPLATE'] compiled = open(app.config['CSS'], 'w') compiled.write(parser.load(template))
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)
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)