本文整理匯總了Python中compressor.CssCompressor.output_inline方法的典型用法代碼示例。如果您正苦於以下問題:Python CssCompressor.output_inline方法的具體用法?Python CssCompressor.output_inline怎麽用?Python CssCompressor.output_inline使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類compressor.CssCompressor
的用法示例。
在下文中一共展示了CssCompressor.output_inline方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: render
# 需要導入模塊: from compressor import CssCompressor [as 別名]
# 或者: from compressor.CssCompressor import output_inline [as 別名]
def render(self, context):
content = self.nodelist.render(context)
if not settings.COMPRESS or not len(content.strip()):
return content
if self.kind == 'css':
compressor = CssCompressor(content)
if self.kind == 'js':
compressor = JsCompressor(content)
cachekey = "%s-%s" % (compressor.cachekey, self.mode)
output = self.cache_get(cachekey)
if output is None:
try:
if self.mode == OUTPUT_FILE:
output = compressor.output()
else:
output = compressor.output_inline()
self.cache_set(cachekey, output)
except:
from traceback import format_exc
raise Exception(format_exc())
return output