def _get_import_paths(settings): # `scss.asset_path` is the path which should be searched to resolve a request if 'sass.asset_path' not in settings: raise ConfigurationError('SCSS renderer requires ``sass.asset_path`` setting') load_paths = [] for s in settings.get('sass.asset_path').split('\n'): if s: p = abspath_from_asset_spec(s.strip()) load_paths.append(p) Logger.info('adding asset path %s', p) # `sass.static_path`, optional, is the path which should be searched to resolve references to static assets in stylesheets static_path = settings.get('sass.static_path', '') if static_path: if 'sass.static_url_root' not in settings: raise ConfigurationError('SCSS renderer requires ``sass.static_url_root`` setting if ``sass.static_path`` is provided') static_path = abspath_from_asset_spec(static_path.strip()) Logger.info('setting static path %s', static_path) # `sass.output_path`, optional, is the path where generated spritemaps should be written assets_path = settings.get('sass.output_path', '') if assets_path: if 'sass.output_url_root' not in settings: raise ConfigurationError('SCSS renderer requires ``sass.output_url_root`` setting if ``sass.output_path`` is provided') assets_path = abspath_from_asset_spec(assets_path.strip()) Logger.info('setting output path %s', assets_path) return (load_paths, static_path, assets_path)
def _get_import_paths(settings): # `scss.asset_path` is the path which should be searched to resolve a request if "scss.asset_path" not in settings: raise ConfigurationError("SCSS renderer requires ``scss.asset_path`` setting") load_paths = [] for s in settings.get("scss.asset_path").split("\n"): if s: p = abspath_from_asset_spec(s.strip()) load_paths.append(p) Logger.info("adding asset path %s", p) # `scss.static_path`, optional, is the path which should be searched to resolve references to static assets in stylesheets static_path = settings.get("scss.static_path", "") if static_path: if "scss.static_url_root" not in settings: raise ConfigurationError( "SCSS renderer requires ``scss.static_url_root`` setting if ``scss.static_path`` is provided" ) static_path = abspath_from_asset_spec(static_path.strip()) Logger.info("setting static path %s", static_path) # `scss.output_path`, optional, is the path where generated spritemaps should be written assets_path = settings.get("scss.output_path", "") if assets_path: if "scss.output_url_root" not in settings: raise ConfigurationError( "SCSS renderer requires ``scss.output_url_root`` setting if ``scss.output_path`` is provided" ) assets_path = abspath_from_asset_spec(assets_path.strip()) Logger.info("setting output path %s", assets_path) return (load_paths, static_path, assets_path)
def _get_asset_path(request): if 'sass.asset_path' not in request.registry.settings: raise ConfigurationError( 'SCSS renderer requires ``sass.asset_path`` setting') scss_name = request.matchdict.get('css_path') + '.scss' css_name = request.matchdict.get('css_path') + '.css' for s in request.registry.settings.get('sass.asset_path').split('\n'): if s: p = abspath_from_asset_spec(os.path.join(s.strip(), scss_name)) if os.path.exists(p): return p, 'scss' p = abspath_from_asset_spec(os.path.join(s.strip(), css_name)) if os.path.exists(p): return p, 'css' raise HTTPNotFound()
def _load_asset(filename, type): path = abspath_from_asset_spec(os.path.join(paths.get(type), filename)) if not os.path.exists(path): raise HTTPNotFound() return open(path)
def _get_import_paths(settings): if 'scss.asset_path' not in settings: raise ConfigurationError('SCSS renderer requires ``scss.asset_path`` setting') load_paths = [] for s in settings.get('scss.asset_path').split('\n'): if s: p = abspath_from_asset_spec(s.strip()) load_paths.append(p) Logger.info('adding asset path %s', p) static_path = settings.get('scss.static_path', '') if static_path: static_path = abspath_from_asset_spec(static_path.strip()) Logger.info('setting static path %s', static_path) return (load_paths, static_path)
def _get_import_paths(settings): if 'scss.asset_path' not in settings: raise ConfigurationError('SCSS renderer requires ``scss.asset_path`` setting') paths = [] for s in settings.get('scss.asset_path').split('\n'): if s: p = abspath_from_asset_spec(s.strip()) paths.append(p) return paths
def _get_asset_path(request): if "scss.asset_path" not in request.registry.settings: raise ConfigurationError("SCSS renderer requires ``scss.asset_path`` setting") filename = request.matchdict.get("css_path") + ".scss" paths = [] for s in request.registry.settings.get("scss.asset_path").split("\n"): if s: p = abspath_from_asset_spec(os.path.join(s.strip(), filename)) paths.append(p) return paths
def _get_asset_path(request): if 'scss.asset_path' not in request.registry.settings: raise ConfigurationError('SCSS renderer requires ``scss.asset_path`` setting') filename = request.matchdict.get('css_path') + '.scss' paths = [] for s in request.registry.settings.get('scss.asset_path').split('\n'): if s: p = abspath_from_asset_spec(os.path.join(s.strip(), filename)) paths.append(p) return paths
def _get_asset_path(request): if 'scss.asset_path' not in request.registry.settings: raise ConfigurationError( 'SCSS renderer requires ``scss.asset_path`` setting') filename = request.matchdict.get('css_path') + '.scss' paths = [] for s in request.registry.settings.get('scss.asset_path').split('\n'): if s: p = abspath_from_asset_spec(os.path.join(s.strip(), filename)) paths.append(p) return paths
def _callFUT(self, spec, pname='__main__'): from pyramid.resource import abspath_from_asset_spec return abspath_from_asset_spec(spec, pname)