• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python utils.get_theme_path函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中nikola.utils.get_theme_path函数的典型用法代码示例。如果您正苦于以下问题:Python get_theme_path函数的具体用法?Python get_theme_path怎么用?Python get_theme_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_theme_path函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: gen_tasks

    def gen_tasks(self):
        """Generate CSS out of LESS sources."""

        kw = {
            'cache_folder': self.site.config['CACHE_FOLDER'],
            'themes': self.site.THEMES,
        }

        # Find where in the theme chain we define the LESS targets
        # There can be many *.less in the folder, but we only will build
        # the ones listed in less/targets
        targets_path = utils.get_asset_path(os.path.join(self.sources_folder, "targets"), self.site.THEMES)
        try:
            with codecs.open(targets_path, "rb", "utf-8") as inf:
                targets = [x.strip() for x in inf.readlines()]
        except Exception:
            targets = []

        for theme_name in kw['themes']:
            src = os.path.join(utils.get_theme_path(theme_name), self.sources_folder)
            for task in utils.copy_tree(src, os.path.join(kw['cache_folder'], self.sources_folder)):
                task['basename'] = 'prepare_less_sources'
                yield task

        # Build targets and write CSS files
        base_path = utils.get_theme_path(self.site.THEMES[0])
        dst_dir = os.path.join(self.site.config['OUTPUT_FOLDER'], 'assets', 'css')
        # Make everything depend on all sources, rough but enough
        deps = glob.glob(os.path.join(
            base_path,
            self.sources_folder,
            "*{0}".format(self.sources_ext)))

        def compile_target(target, dst):
            utils.makedirs(dst_dir)
            src = os.path.join(kw['cache_folder'], self.sources_folder, target)
            try:
                compiled = subprocess.check_output([self.compiler_name, src])
            except OSError:
                utils.req_missing([self.compiler_name],
                                  'build LESS files (and use this theme)',
                                  False, False)
            with open(dst, "wb+") as outf:
                outf.write(compiled)

        yield self.group_task()

        for target in targets:
            dst = os.path.join(dst_dir, target.replace(self.sources_ext, ".css"))
            yield {
                'basename': self.name,
                'name': dst,
                'targets': [dst],
                'file_dep': deps,
                'task_dep': ['prepare_less_sources'],
                'actions': ((compile_target, [target, dst]), ),
                'uptodate': [utils.config_changed(kw)],
                'clean': True
            }
开发者ID:agustinhenze,项目名称:nikola,代码行数:59,代码来源:build_less.py


示例2: _execute

    def _execute(self, options, args):
        """Install theme into current site."""
        listing = options['list']
        url = options['url']
        if args:
            name = args[0]
        else:
            name = None

        if options['getpath'] and name:
            path = utils.get_theme_path(name)
            if path:
                print(path)
            else:
                print('not installed')
            return 0

        if name is None and not listing:
            LOGGER.error("This command needs either a theme name or the -l option.")
            return False
        try:
            data = requests.get(url).json()
        except requests.exceptions.SSLError:
            LOGGER.warning("SSL error, using http instead of https (press ^C to abort)")
            time.sleep(1)
            url = url.replace('https', 'http', 1)
            data = requests.get(url).json()
        if listing:
            print("Themes:")
            print("-------")
            for theme in sorted(data.keys()):
                print(theme)
            return True
        else:
            # `name` may be modified by the while loop.
            origname = name
            installstatus = self.do_install(name, data)
            # See if the theme's parent is available. If not, install it
            while True:
                parent_name = utils.get_parent_theme_name(name)
                if parent_name is None:
                    break
                try:
                    utils.get_theme_path(parent_name)
                    break
                except:  # Not available
                    self.do_install(parent_name, data)
                    name = parent_name
            if installstatus:
                LOGGER.notice('Remember to set THEME="{0}" in conf.py to use this theme.'.format(origname))
开发者ID:carlosvin,项目名称:nikola,代码行数:50,代码来源:install_theme.py


示例3: gen_tasks

    def gen_tasks(self):
        """Generate CSS out of LESS sources."""

        kw = {"cache_folder": self.site.config["CACHE_FOLDER"], "themes": self.site.THEMES}

        # Find where in the theme chain we define the LESS targets
        # There can be many *.less in the folder, but we only will build
        # the ones listed in less/targets
        targets_path = utils.get_asset_path(os.path.join(self.sources_folder, "targets"), self.site.THEMES)
        try:
            with codecs.open(targets_path, "rb", "utf-8") as inf:
                targets = [x.strip() for x in inf.readlines()]
        except Exception:
            targets = []

        for theme_name in kw["themes"]:
            src = os.path.join(utils.get_theme_path(theme_name), self.sources_folder)
            for task in utils.copy_tree(src, os.path.join(kw["cache_folder"], self.sources_folder)):
                # task['basename'] = self.name
                yield task

        # Build targets and write CSS files
        base_path = utils.get_theme_path(self.site.THEMES[0])
        dst_dir = os.path.join(self.site.config["OUTPUT_FOLDER"], "assets", "css")
        # Make everything depend on all sources, rough but enough
        deps = glob.glob(os.path.join(base_path, self.sources_folder, "*{0}".format(self.sources_ext)))

        def compile_target(target, dst):
            if not os.path.isdir(dst_dir):
                os.makedirs(dst_dir)
            src = os.path.join(kw["cache_folder"], self.sources_folder, target)
            compiled = subprocess.check_output([self.compiler_name, src])
            with open(dst, "wb+") as outf:
                outf.write(compiled)

        for target in targets:
            dst = os.path.join(dst_dir, target.replace(self.sources_ext, ".css"))
            yield {
                "basename": self.name,
                "name": dst,
                "targets": [dst],
                "file_dep": deps,
                "actions": ((compile_target, [target, dst]),),
                "uptodate": [utils.config_changed(kw)],
                "clean": True,
            }

        if not targets:
            yield {"basename": self.name, "actions": []}
开发者ID:mrabbitt,项目名称:nikola,代码行数:49,代码来源:build_less.py


示例4: do_install

    def do_install(self, name, data):
        if name in data:
            utils.makedirs(self.output_dir)
            LOGGER.notice('Downloading: ' + data[name])
            zip_file = BytesIO()
            zip_file.write(requests.get(data[name]).content)
            LOGGER.notice('Extracting: {0} into themes'.format(name))
            utils.extract_all(zip_file)
            dest_path = os.path.join('themes', name)
        else:
            try:
                theme_path = utils.get_theme_path(name)
            except:
                LOGGER.error("Can't find theme " + name)
                return False

            utils.makedirs(self.output_dir)
            dest_path = os.path.join(self.output_dir, name)
            if os.path.exists(dest_path):
                LOGGER.error("{0} is already installed".format(name))
                return False

            LOGGER.notice('Copying {0} into themes'.format(theme_path))
            shutil.copytree(theme_path, dest_path)
        confpypath = os.path.join(dest_path, 'conf.py.sample')
        if os.path.exists(confpypath):
            LOGGER.notice('This plugin has a sample config file.')
            print('Contents of the conf.py.sample file:\n')
            with codecs.open(confpypath, 'rb', 'utf-8') as fh:
                print(indent(pygments.highlight(
                    fh.read(), PythonLexer(), TerminalFormatter()), 4 * ' '))
            return True
开发者ID:AndreaCrotti,项目名称:nikola,代码行数:32,代码来源:install_theme.py


示例5: generate_css

        def generate_css():
            # Compass compile
            for theme_name in self.site.THEMES:

                theme_root = os.path.abspath(utils.get_theme_path(theme_name))
                compass_root = os.path.abspath(os.path.join(theme_root, 'style'))
                tmp_dir = os.path.abspath(os.path.join(theme_root, '_tmp'))

                if os.path.exists(compass_root):

                    LOGGER.notice("PYGMENTS CSS CODE")
                    create_code_css(self.site.config['CODE_COLOR_SCHEME'],
                                    os.path.join(compass_root, 'css', 'code.css'))


                    LOGGER.notice("COMPASS COMPILE")
                    run('compass clean', cwd=compass_root)
                    run('compass compile', cwd=compass_root)

                    LOGGER.notice("AUTOPREFIXER")
                    LOGGER.notice("CWD: {}".format(theme_root))
                    run('autoprefixer -o _tmp/all.pre.css _tmp/all.css', cwd=theme_root)

                    LOGGER.notice("CSSO (CSS optimizer)")
                    LOGGER.notice("CWD: {}".format(theme_root))
                    run('csso _tmp/all.pre.css _tmp/all.min.css', cwd=theme_root)


                    LOGGER.notice("Move CSS to output")
                    css_output_dir = os.path.join(os.path.abspath(self.site.config['OUTPUT_FOLDER']), 'assets', 'css')
                    utils.makedirs(css_output_dir)
                    shutil.copy2(os.path.join(tmp_dir, 'all.min.css'), css_output_dir)
开发者ID:jlesquembre,项目名称:blog,代码行数:32,代码来源:compilecss.py


示例6: gen_tasks

    def gen_tasks(self):
        """Create tasks to copy the assets of the whole theme chain.

        If a file is present on two themes, use the version
        from the "youngest" theme.
        """

        kw = {
            "themes": self.site.THEMES,
            "output_folder": self.site.config['OUTPUT_FOLDER'],
            "filters": self.site.config['FILTERS'],
        }
        flag = True
        tasks = {}
        for theme_name in kw['themes']:
            src = os.path.join(utils.get_theme_path(theme_name), 'assets')
            dst = os.path.join(kw['output_folder'], 'assets')
            for task in utils.copy_tree(src, dst):
                if task['name'] in tasks:
                    continue
                tasks[task['name']] = task
                task['uptodate'] = [utils.config_changed(kw)]
                task['basename'] = self.name
                flag = False
                yield utils.apply_filters(task, kw['filters'])

        if flag:
            yield {
                'basename': self.name,
                'name': 'None',
                'uptodate': [True],
                'actions': [],
            }
开发者ID:snaewe,项目名称:nikola,代码行数:33,代码来源:task_copy_assets.py


示例7: do_install

    def do_install(self, name, data):
        if name in data:
            utils.makedirs(self.output_dir)
            LOGGER.info("Downloading '{0}'".format(data[name]))
            zip_file = io.BytesIO()
            zip_file.write(requests.get(data[name]).content)
            LOGGER.info("Extracting '{0}' into themes/".format(name))
            utils.extract_all(zip_file)
            dest_path = os.path.join(self.output_dir, name)
        else:
            dest_path = os.path.join(self.output_dir, name)
            try:
                theme_path = utils.get_theme_path(name)
                LOGGER.error("Theme '{0}' is already installed in {1}".format(name, theme_path))
            except Exception:
                LOGGER.error("Can't find theme {0}".format(name))

            return False

        confpypath = os.path.join(dest_path, 'conf.py.sample')
        if os.path.exists(confpypath):
            LOGGER.notice('This theme has a sample config file.  Integrate it with yours in order to make this theme work!')
            print('Contents of the conf.py.sample file:\n')
            with io.open(confpypath, 'r', encoding='utf-8') as fh:
                if self.site.colorful:
                    print(utils.indent(pygments.highlight(
                        fh.read(), PythonLexer(), TerminalFormatter()),
                        4 * ' '))
                else:
                    print(utils.indent(fh.read(), 4 * ' '))
        return True
开发者ID:habilain,项目名称:nikola,代码行数:31,代码来源:install_theme.py


示例8: get_path

 def get_path(self, name):
     """Get path for an installed theme."""
     try:
         path = utils.get_theme_path(name)
         print(path)
     except Exception:
         print("not installed")
     return 0
开发者ID:Cadair,项目名称:nikola,代码行数:8,代码来源:theme.py


示例9: gen_tasks

    def gen_tasks(self):
        """Create tasks to copy the assets of the whole theme chain.

        If a file is present on two themes, use the version
        from the "youngest" theme.
        """

        kw = {
            "themes": self.site.THEMES,
            "output_folder": self.site.config['OUTPUT_FOLDER'],
            "filters": self.site.config['FILTERS'],
            "code_color_scheme": self.site.config['CODE_COLOR_SCHEME'],
        }
        flag = True
        has_code_css = False
        tasks = {}
        code_css_path = os.path.join(kw['output_folder'], 'assets', 'css', 'code.css')
        for theme_name in kw['themes']:
            src = os.path.join(utils.get_theme_path(theme_name), 'assets')
            dst = os.path.join(kw['output_folder'], 'assets')
            for task in utils.copy_tree(src, dst):
                if task['name'] in tasks:
                    continue
                if task['targets'][0] == code_css_path:
                    has_code_css = True
                tasks[task['name']] = task
                task['uptodate'] = [utils.config_changed(kw)]
                task['basename'] = self.name
                flag = False
                yield utils.apply_filters(task, kw['filters'])

        if flag:
            yield {
                'basename': self.name,
                'name': 'None',
                'uptodate': [True],
                'actions': [],
            }

        if not has_code_css:  # Generate it

            def create_code_css():
                from pygments.formatters import get_formatter_by_name
                formatter = get_formatter_by_name('html', style=kw["code_color_scheme"])
                utils.makedirs(os.path.dirname(code_css_path))
                with codecs.open(code_css_path, 'wb+', 'utf8') as outf:
                    outf.write(formatter.get_style_defs('.code'))
                    outf.write("table.codetable { width: 100%;} td.linenos {text-align: right; width: 4em;}")

            task = {
                'basename': self.name,
                'name': code_css_path,
                'targets': [code_css_path],
                'uptodate': [utils.config_changed(kw)],
                'actions': [(create_code_css, [])],
                'clean': True,
            }
            yield utils.apply_filters(task, kw['filters'])
开发者ID:emilopez,项目名称:nikola,代码行数:58,代码来源:copy_assets.py


示例10: _execute

    def _execute(self, options, args):
        """Install theme into current site."""
        listing = options['list']
        url = options['url']
        if args:
            name = args[0]
        else:
            name = None

        if options['getpath'] and name:
            path = utils.get_theme_path(name)
            if path:
                print(path)
            else:
                print('not installed')
            exit(0)

        if name is None and not listing:
            LOGGER.error("This command needs either a theme name or the -l option.")
            return False
        data = requests.get(url).text
        data = json.loads(data)
        if listing:
            print("Themes:")
            print("-------")
            for theme in sorted(data.keys()):
                print(theme)
            return True
        else:
            # `name` may be modified by the while loop.
            origname = name
            installstatus = self.do_install(name, data)
            # See if the theme's parent is available. If not, install it
            while True:
                parent_name = utils.get_parent_theme_name(name)
                if parent_name is None:
                    break
                try:
                    utils.get_theme_path(parent_name)
                    break
                except:  # Not available
                    self.do_install(parent_name, data)
                    name = parent_name
            if installstatus:
                LOGGER.notice('Remember to set THEME="{0}" in conf.py to use this theme.'.format(origname))
开发者ID:sharifulgeo,项目名称:nikola,代码行数:45,代码来源:install_theme.py


示例11: do_install_deps

 def do_install_deps(self, url, name):
     """Install themes and their dependencies."""
     data = self.get_json(url)
     # `name` may be modified by the while loop.
     origname = name
     installstatus = self.do_install(name, data)
     # See if the theme's parent is available. If not, install it
     while True:
         parent_name = utils.get_parent_theme_name(name)
         if parent_name is None:
             break
         try:
             utils.get_theme_path(parent_name)
             break
         except:  # Not available
             self.do_install(parent_name, data)
             name = parent_name
     if installstatus:
         LOGGER.notice('Remember to set THEME="{0}" in conf.py to use this theme.'.format(origname))
开发者ID:Cadair,项目名称:nikola,代码行数:19,代码来源:theme.py


示例12: gen_tasks

    def gen_tasks(self):
        """Create tasks to copy the assets of the whole theme chain.

        If a file is present on two themes, use the version
        from the "youngest" theme.
        """

        kw = {
            "themes": self.site.THEMES,
            "output_folder": self.site.config["OUTPUT_FOLDER"],
            "filters": self.site.config["FILTERS"],
            "code_color_scheme": self.site.config["CODE_COLOR_SCHEME"],
        }
        has_code_css = False
        tasks = {}
        code_css_path = os.path.join(kw["output_folder"], "assets", "css", "code.css")

        yield self.group_task()

        for theme_name in kw["themes"]:
            src = os.path.join(utils.get_theme_path(theme_name), "assets")
            dst = os.path.join(kw["output_folder"], "assets")
            for task in utils.copy_tree(src, dst):
                if task["name"] in tasks:
                    continue
                if task["targets"][0] == code_css_path:
                    has_code_css = True
                tasks[task["name"]] = task
                task["uptodate"] = [utils.config_changed(kw)]
                task["basename"] = self.name
                yield utils.apply_filters(task, kw["filters"])

        if not has_code_css:  # Generate it

            def create_code_css():
                from pygments.formatters import get_formatter_by_name

                formatter = get_formatter_by_name("html", style=kw["code_color_scheme"])
                utils.makedirs(os.path.dirname(code_css_path))
                with codecs.open(code_css_path, "wb+", "utf8") as outf:
                    outf.write(formatter.get_style_defs(["pre.code", "div.code pre"]))
                    outf.write("\ntable.codetable { width: 100%;} td.linenos {text-align: right; width: 4em;}\n")

            task = {
                "basename": self.name,
                "name": code_css_path,
                "targets": [code_css_path],
                "uptodate": [utils.config_changed(kw)],
                "actions": [(create_code_css, [])],
                "clean": True,
            }
            yield utils.apply_filters(task, kw["filters"])
开发者ID:jonhedson,项目名称:nikola,代码行数:52,代码来源:copy_assets.py


示例13: get_theme_bundles

def get_theme_bundles(themes):
    """Given a theme chain, return the bundle definitions."""
    bundles = {}
    for theme_name in themes:
        bundles_path = os.path.join(utils.get_theme_path(theme_name), "bundles")
        if os.path.isfile(bundles_path):
            with open(bundles_path) as fd:
                for line in fd:
                    name, files = line.split("=")
                    files = [f.strip() for f in files.split(",")]
                    bundles[name.strip()] = files
                break
    return bundles
开发者ID:Proteus-tech,项目名称:nikola,代码行数:13,代码来源:bundles.py


示例14: _execute

    def _execute(self, options, args):
        """Install theme into current site."""
        if requests is None:
            utils.LOGGER.error('This command requires the requests package be installed.')
            return False

        listing = options['list']
        url = options['url']
        if args:
            name = args[0]
        else:
            name = None

        if name is None and not listing:
            utils.LOGGER.error("This command needs either a theme name or the -l option.")
            return False
        data = requests.get(url).text
        data = json.loads(data)
        if listing:
            print("Themes:")
            print("-------")
            for theme in sorted(data.keys()):
                print(theme)
            return True
        else:
            self.do_install(name, data)
        # See if the theme's parent is available. If not, install it
        while True:
            parent_name = utils.get_parent_theme_name(name)
            if parent_name is None:
                break
            try:
                utils.get_theme_path(parent_name)
                break
            except:  # Not available
                self.do_install(parent_name, data)
                name = parent_name
开发者ID:emilopez,项目名称:nikola,代码行数:37,代码来源:install_theme.py


示例15: do_uninstall

 def do_uninstall(self, name):
     """Uninstall a theme."""
     try:
         path = utils.get_theme_path(name)
     except Exception:
         LOGGER.error('Unknown theme: {0}'.format(name))
         return 1
     LOGGER.warning('About to uninstall theme: {0}'.format(name))
     LOGGER.warning('This will delete {0}'.format(path))
     sure = utils.ask_yesno('Are you sure?')
     if sure:
         LOGGER.warning('Removing {0}'.format(path))
         shutil.rmtree(path)
         return 0
     return 1
开发者ID:Cadair,项目名称:nikola,代码行数:15,代码来源:theme.py


示例16: get_theme_bundles

def get_theme_bundles(themes):
    """Given a theme chain, return the bundle definitions."""
    for theme_name in themes:
        bundles_path = os.path.join(
            utils.get_theme_path(theme_name), 'bundles')
        if os.path.isfile(bundles_path):
            config = configparser.ConfigParser()
            header = io.StringIO('[bundles]\n')
            with open(bundles_path, 'rt') as fd:
                config.read_file(itertools.chain(header, fd))
            bundles = {}
            for name, files in config['bundles'].items():
                name = name.strip().replace('/', os.sep)
                files = [f.strip() for f in files.split(',') if f.strip()]
                bundles[name] = files
            return bundles
开发者ID:getnikola,项目名称:nikola,代码行数:16,代码来源:bundles.py


示例17: get_theme_bundles

def get_theme_bundles(themes):
    """Given a theme chain, return the bundle definitions."""
    bundles = {}
    for theme_name in themes:
        bundles_path = os.path.join(
            utils.get_theme_path(theme_name), 'bundles')
        if os.path.isfile(bundles_path):
            with open(bundles_path) as fd:
                for line in fd:
                    try:
                        name, files = line.split('=')
                        files = [f.strip() for f in files.split(',')]
                        bundles[name.strip().replace('/', os.sep)] = files
                    except ValueError:
                        # for empty lines
                        pass
                break
    return bundles
开发者ID:andredias,项目名称:nikola,代码行数:18,代码来源:bundles.py


示例18: gen_tasks

    def gen_tasks(self):
        """Tweak theming by generating a LESS definition file."""

        template = self.site.config.get("LESS_THEME_TEMPLATE", "")
        if not template:
            print ("No less theme template found... exiting.")
            yield {"basename": self.name, "actions": []}
            return
        timeout_time = self.site.config.get("THEME_TIMEOUT", datetime.timedelta(days=1))

        kw = {"cache_folder": self.site.config["CACHE_FOLDER"], "themes": self.site.THEMES, "template": template}

        # Build targets and write CSS files
        base_path = utils.get_theme_path(self.site.THEMES[0])
        dst_dir = os.path.join(base_path, self.sources_folder)
        target = os.path.join(dst_dir, "define.less")
        json_target = os.path.join(self.site.config["OUTPUT_FOLDER"], "assets", "js", "background_image_data.json")

        def write_theme_define():
            """ Write the theme file and json data file.
            """
            try:
                image_data = get_random_image()
                bg_url = image_data["url"].strip()
                thumbnail = image_data["thumbnail_url"].strip()
                base_color = color_from_url(thumbnail)
            except Exception as e:
                print "Failed to change image."
                print e
                return {"basename": self.name, "actions": []}
            with codecs.open(target, "w", "utf-8") as f:
                f.write(template % (base_color, bg_url))
            with codecs.open(json_target, "w", "utf-8") as f:
                json.dump(image_data, f, indent=2)

        yield {
            "basename": self.name,
            "name": target,
            "targets": [target, json_target],
            "actions": [(write_theme_define, [])],
            "uptodate": [timeout(timeout_time), os.path.exists(target), utils.config_changed(kw)],
            "clean": True,
            "verbosity": 2,
        }
开发者ID:huckerdom,项目名称:ultimate-sport,代码行数:44,代码来源:themes.py


示例19: do_install

    def do_install(self, name, data):
        """Download and install a theme."""
        if name in data:
            utils.makedirs(self.output_dir)
            url = data[name]
            LOGGER.info("Downloading '{0}'".format(url))
            try:
                zip_data = requests.get(url).content
            except requests.exceptions.SSLError:
                LOGGER.warning("SSL error, using http instead of https (press ^C to abort)")
                time.sleep(1)
                url = url.replace('https', 'http', 1)
                zip_data = requests.get(url).content

            zip_file = io.BytesIO()
            zip_file.write(zip_data)
            LOGGER.info("Extracting '{0}' into themes/".format(name))
            utils.extract_all(zip_file)
            dest_path = os.path.join(self.output_dir, name)
        else:
            dest_path = os.path.join(self.output_dir, name)
            try:
                theme_path = utils.get_theme_path(name)
                LOGGER.error("Theme '{0}' is already installed in {1}".format(name, theme_path))
            except Exception:
                LOGGER.error("Can't find theme {0}".format(name))

            return False

        confpypath = os.path.join(dest_path, 'conf.py.sample')
        if os.path.exists(confpypath):
            LOGGER.notice('This theme has a sample config file.  Integrate it with yours in order to make this theme work!')
            print('Contents of the conf.py.sample file:\n')
            with io.open(confpypath, 'r', encoding='utf-8') as fh:
                if self.site.colorful:
                    print(utils.indent(pygments.highlight(
                        fh.read(), PythonLexer(), TerminalFormatter()),
                        4 * ' '))
                else:
                    print(utils.indent(fh.read(), 4 * ' '))
        return True
开发者ID:GetsDrawn,项目名称:nikola,代码行数:41,代码来源:install_theme.py


示例20: gen_tasks

  def gen_tasks(self):
      """Copy static files into the output folder."""

      kw = {
          "themes": self.site.THEMES,
          "output_folder": self.site.config['OUTPUT_FOLDER'],
          "filters": self.site.config['FILTERS'],
      }

      flag = True
      
      for theme_name in kw['themes']:
          src = os.path.join(utils.get_theme_path(theme_name), 'assets', 'css')
          for root, dirs, files in os.walk(src):
            for src_name in files:
                if src_name.endswith('.less'):
                  flag=False
                  
                  src_file = os.path.join(root, src_name)
                  
                  dst_file_name = src_name.replace('.less', '.css')      
                  dst_file = os.path.join(root, dst_file_name)
                  
                  yield {
                      'basename' : self.name,
                      'name': str(dst_file),
                      'file_dep': [src_file],
                      'targets': [dst_file],
                      'actions': [(lessify, (src_file, dst_file))],
                      'clean': True,
                  }

      if flag:
          yield {
              'basename': self.name,
              'name': 'None',
              'uptodate': [True],
              'actions': [],
          }
开发者ID:trustrachel,项目名称:trustrachel.com,代码行数:39,代码来源:task_convert_less.py



注:本文中的nikola.utils.get_theme_path函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.get_translation_candidate函数代码示例发布时间:2022-05-27
下一篇:
Python utils.get_logger函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap