当前位置: 首页>>代码示例>>Python>>正文


Python Packager.pack_stylesheets方法代码示例

本文整理汇总了Python中pipeline.packager.Packager.pack_stylesheets方法的典型用法代码示例。如果您正苦于以下问题:Python Packager.pack_stylesheets方法的具体用法?Python Packager.pack_stylesheets怎么用?Python Packager.pack_stylesheets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pipeline.packager.Packager的用法示例。


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

示例1: post_process

# 需要导入模块: from pipeline.packager import Packager [as 别名]
# 或者: from pipeline.packager.Packager import pack_stylesheets [as 别名]
    def post_process(self, paths, dry_run=False, **options):
        if dry_run:
            return

        from pipeline.packager import Packager
        packager = Packager(storage=self)
        for package_name in packager.packages['css']:
            package = packager.package_for('css', package_name)
            output_file = package.output_filename
            if self.packing:
                packager.pack_stylesheets(package)
            paths[output_file] = (self, output_file)
            yield output_file, output_file, True
        for package_name in packager.packages['js']:
            package = packager.package_for('js', package_name)
            output_file = package.output_filename
            if self.packing:
                packager.pack_javascripts(package)
            paths[output_file] = (self, output_file)
            yield output_file, output_file, True

        super_class = super(PipelineMixin, self)
        if hasattr(super_class, 'post_process'):
            for name, hashed_name, processed in super_class.post_process(paths.copy(), dry_run, **options):
                yield name, hashed_name, processed
开发者ID:newscred,项目名称:django-pipeline,代码行数:27,代码来源:storage.py

示例2: post_process

# 需要导入模块: from pipeline.packager import Packager [as 别名]
# 或者: from pipeline.packager.Packager import pack_stylesheets [as 别名]
    def post_process(self, paths, dry_run=False, **options):
        """
        This post_process hook is used to package all themed assets.
        """
        if dry_run:
            return
        themes = get_themes()

        for theme in themes:
            css_packages = self.get_themed_packages(theme.theme_dir_name, settings.PIPELINE_CSS)

            from pipeline.packager import Packager
            packager = Packager(storage=self, css_packages=css_packages)
            for package_name in packager.packages['css']:
                package = packager.package_for('css', package_name)
                output_file = package.output_filename
                if self.packing:
                    packager.pack_stylesheets(package)
                paths[output_file] = (self, output_file)
                yield output_file, output_file, True

        super_class = super(ThemePipelineMixin, self)
        if hasattr(super_class, 'post_process'):
            for name, hashed_name, processed in super_class.post_process(paths.copy(), dry_run, **options):
                yield name, hashed_name, processed
开发者ID:lduarte1991,项目名称:edx-platform,代码行数:27,代码来源:storage.py

示例3: post_process

# 需要导入模块: from pipeline.packager import Packager [as 别名]
# 或者: from pipeline.packager.Packager import pack_stylesheets [as 别名]
    def post_process(self, paths, dry_run=False, **options):
        if dry_run:
            return []

        from pipeline.packager import Packager
        packager = Packager(storage=self)
        for package_name in packager.packages['css']:
            package = packager.package_for('css', package_name)
            output_file = package.output_filename
            if self.packing:
                packager.pack_stylesheets(package)
            paths[output_file] = (self, output_file)
        for package_name in packager.packages['js']:
            package = packager.package_for('js', package_name)
            output_file = package.output_filename
            if self.packing:
                packager.pack_javascripts(package)
            paths[output_file] = (self, output_file)

        super_class = super(PipelineMixin, self)
        if hasattr(super_class, 'post_process'):
            return super_class.post_process(paths, dry_run, **options)

        return [
            (path, path, True)
            for path in paths
        ]
开发者ID:edwinlunando,项目名称:django-pipeline,代码行数:29,代码来源:storage.py

示例4: post_process

# 需要导入模块: from pipeline.packager import Packager [as 别名]
# 或者: from pipeline.packager.Packager import pack_stylesheets [as 别名]
    def post_process(self, paths, dry_run=False, **options):
        if dry_run:
            return

        packager = Packager(storage=self)
        for _abs_path, rel_path in paths:
            files_to_process = OrderedDict()
            files_to_process[rel_path] = (self, rel_path)
            for package_name in packager.packages['css']:
                package = packager.package_for('css', package_name)
                output_file = package.output_filename

                if rel_path in package.paths:
                    if self.packing:
                        packager.pack_stylesheets(package)
                    files_to_process[output_file] = (self, output_file)
                    yield output_file, output_file, True
            for package_name in packager.packages['js']:
                package = packager.package_for('js', package_name)
                output_file = package.output_filename
                if rel_path in package.paths:
                    if self.packing:
                        packager.pack_javascripts(package)
                    files_to_process[output_file] = (self, output_file)
                    yield output_file, output_file, True

            super_class = super(PipelineMixin, self)

            if hasattr(super_class, 'post_process'):
                for name, hashed_name, processed in super_class.post_process(
                        files_to_process.copy(), dry_run, **options):
                    yield name, hashed_name, processed
开发者ID:pfertyk,项目名称:django-deploy-utils,代码行数:34,代码来源:storage.py

示例5: handle

# 需要导入模块: from pipeline.packager import Packager [as 别名]
# 或者: from pipeline.packager.Packager import pack_stylesheets [as 别名]
    def handle(self, *args, **options):
        from pipeline.packager import Packager

        force = options.get('force', False)
        verbose = int(options.get('verbosity', 1)) >= 2
        sync = options.get('dry_run', True)

        packager = Packager(verbose=verbose)
        for package_name in packager.packages['css']:
            if args and package_name not in args:
                continue
            package = packager.package_for('css', package_name)
            if verbose:
                print
                message = "CSS Group '%s'" % package_name
                print message
                print len(message) * '-'
            packager.pack_stylesheets(package, sync=sync, force=force)

        for package_name in packager.packages['js']:
            if args and package_name not in args:
                continue
            package = packager.package_for('js', package_name)
            if verbose:
                print
                message = "JS Group '%s'" % package_name
                print message
                print len(message) * '-'
            packager.pack_javascripts(package, sync=sync, force=force)
开发者ID:UniIsland,项目名称:django-pipeline,代码行数:31,代码来源:synccompress.py

示例6: CompressedCSSNode

# 需要导入模块: from pipeline.packager import Packager [as 别名]
# 或者: from pipeline.packager.Packager import pack_stylesheets [as 别名]
class CompressedCSSNode(template.Node):
    def __init__(self, name):
        self.name = name
        self.packager = Packager()

    def render(self, context):
        package_name = template.Variable(self.name).resolve(context)
        try:
            package = self.packager.package_for('css', package_name)
        except PackageNotFound:
            return ''  # fail silently, do not return anything if an invalid group is specified

        if settings.PIPELINE:
            compressed_path = self.packager.pack_stylesheets(package)
            return self.render_css(package, compressed_path)
        else:
            package['paths'] = self.packager.compile(package['paths'])
            return self.render_individual(package)

    def render_css(self, package, path):
        context = {}
        if not 'template' in package:
            package['template'] = "pipeline/css.html"
        if not 'context' in package:
            context = package['context']
        context.update({
            'url': self.packager.individual_url(path)
        })
        return render_to_string(package['template'], context)

    def render_individual(self, package):
        tags = [self.render_css(package, path) for path in package['paths']]
        return '\n'.join(tags)
开发者ID:foonnnnn,项目名称:django-pipeline,代码行数:35,代码来源:compressed.py

示例7: post_process

# 需要导入模块: from pipeline.packager import Packager [as 别名]
# 或者: from pipeline.packager.Packager import pack_stylesheets [as 别名]
    def post_process(self, paths, dry_run=False, **options):
        if dry_run:
            return []

        from pipeline.packager import Packager
        packager = Packager(storage=self)
        for package_name in packager.packages['css']:
            package = packager.package_for('css', package_name)
            if self.packing:
                paths_written = packager.pack_stylesheets(package)
                for path in paths_written:
                    paths[path] = (self, path)
            else:
                # TODO: bcooksey 5/15/13. Not sure why we pretend we packed if packing is false...will this mess up source maps
                output_file = package.output_filename
                paths[output_file] = (self, output_file)
        for package_name in packager.packages['js']:
            package = packager.package_for('js', package_name)
            if self.packing:
                paths_written = packager.pack_javascripts(package)
                for path in paths_written:
                    paths[path] = (self, path)
            else:
                # TODO: bcooksey 5/15/13. Not sure why we pretend we packed if packing is false...will this mess up source maps
                output_file = package.output_filename
                paths[output_file] = (self, output_file)

        super_class = super(PipelineMixin, self)
        if hasattr(super_class, 'post_process'):
            return super_class.post_process(paths, dry_run, **options)

        return [
            (path, path, True)
            for path in paths
        ]
开发者ID:zapier,项目名称:django-pipeline,代码行数:37,代码来源:storage.py

示例8: handle_noargs

# 需要导入模块: from pipeline.packager import Packager [as 别名]
# 或者: from pipeline.packager.Packager import pack_stylesheets [as 别名]
    def handle_noargs(self, **options):
        from pipeline.packager import Packager
        packager = Packager(
            force=options.get('force', False),
            verbose=int(options.get('verbosity', 1)) >= 2
        )

        for package_name in packager.packages['css']:
            package = packager.package_for('css', package_name)
            if packager.verbose or packager.force:
                print
                message = "CSS Group '%s'" % package_name
                print message
                print len(message) * '-'
            packager.pack_stylesheets(package)

        for package_name in packager.packages['js']:
            package = packager.package_for('js', package_name)
            if packager.verbose or packager.force:
                print
                message = "JS Group '%s'" % package_name
                print message
                print len(message) * '-'
            packager.pack_javascripts(package)
开发者ID:foonnnnn,项目名称:django-pipeline,代码行数:26,代码来源:synccompress.py


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