本文整理汇总了Python中scss.Scss.load_string方法的典型用法代码示例。如果您正苦于以下问题:Python Scss.load_string方法的具体用法?Python Scss.load_string怎么用?Python Scss.load_string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scss.Scss
的用法示例。
在下文中一共展示了Scss.load_string方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from scss import Scss [as 别名]
# 或者: from scss.Scss import load_string [as 别名]
#.........这里部分代码省略.........
elif options.version:
print BUILD_INFO
elif options.interactive:
from pprint import pprint
try:
import atexit
import readline
histfile = os.path.expanduser('~/.scss-history')
try:
readline.read_history_file(histfile)
except IOError:
pass
atexit.register(readline.write_history_file, histfile)
except ImportError:
pass
css = Scss()
context = css.scss_vars
options = css.scss_opts
rule = spawn_rule(context=context, options=options)
print "Welcome to %s interactive shell" % BUILD_INFO
while True:
try:
s = raw_input('>>> ').strip()
except EOFError:
print
break
except KeyboardInterrupt:
print
break
if s in ('exit', 'quit'):
break
for s in s.split(';'):
s = css.load_string(s.strip())
if not s:
continue
elif s.startswith('@'):
properties = []
children = deque()
spawn_rule(fileid='<string>', context=context, options=options, properties=properties)
code, name = (s.split(None, 1) + [''])[:2]
if code == '@option':
css._settle_options(rule, [''], set(), children, None, None, s, None, code, name)
continue
elif code == '@import':
css._do_import(rule, [''], set(), children, None, None, s, None, code, name)
continue
elif code == '@include':
final_cont = ''
css._do_include(rule, [''], set(), children, None, None, s, None, code, name)
code = css._print_properties(properties).rstrip('\n')
if code:
final_cont += code
if children:
css.children.extendleft(children)
css.parse_children()
code = css._create_css(css.rules).rstrip('\n')
if code:
final_cont += code
final_cont = css.post_process(final_cont)
print final_cont
continue
elif s == 'ls' or s.startswith('show(') or s.startswith('show ') or s.startswith('ls(') or s.startswith('ls '):
m = re.match(r'(?:show|ls)(\()?\s*([^,/\\) ]*)(?:[,/\\ ]([^,/\\ )]+))*(?(1)\))', s, re.IGNORECASE)
if m:
name = m.group(2)