pyscss.py 文件源码

python
阅读 14 收藏 0 点赞 0 评论 0

项目:WhatTheHack 作者: Sylphias 项目源码 文件源码
def setup(self):
        super(PyScss, self).setup()

        import scss
        self.scss = scss

        if self.style:
            try:
                from packaging.version import Version
            except ImportError:
                from distutils.version import LooseVersion as Version
            assert Version(scss.__version__) >= Version('1.2.0'), \
                'PYSCSS_STYLE only supported in pyScss>=1.2.0'

        # Initialize various settings:
        # Why are these module-level, not instance-level ?!
        # TODO: It appears that in the current dev version, the
        # settings can finally passed to a constructor. We'll need
        # to support this.

        # Only the dev version appears to support a list
        if self.load_paths:
            scss.config.LOAD_PATHS = ','.join(self.load_paths)

        # These are needed for various helpers (working with images
        # etc.). Similar to the compass filter, we require the user
        # to specify such paths relative to the media directory.
        try:
            scss.config.STATIC_ROOT = self.static_root or self.ctx.directory
            scss.config.STATIC_URL = self.static_url or self.ctx.url
        except EnvironmentError:
            raise EnvironmentError('Because Environment.url and/or '
                'Environment.directory are not set, you need to '
                'provide values for the PYSCSS_STATIC_URL and/or '
                'PYSCSS_STATIC_ROOT settings.')

        # This directory PyScss will use when generating new files,
        # like a spritemap. Maybe we should REQUIRE this to be set.
        scss.config.ASSETS_ROOT = self.assets_root or scss.config.STATIC_ROOT
        scss.config.ASSETS_URL = self.assets_url or scss.config.STATIC_URL
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号