def run(self, filename, pipedata):
        if not pipedata.get('fontcrunch'):
            return  # run fontcrunch only if user set flag in config
        filename = os.path.join(self.builddir, filename)
        self.bakery.logging_raw('### Fontcrunch {}\n'.format(filename))

        fontcrunch.optimize(filename, '{}.crunched'.format(filename))
        shutil.move('{}.crunched'.format(filename), filename)
        return 1
Exemple #2
0
    def run(self, filename, pipedata):
        if not pipedata.get('fontcrunch'):
            return  # run fontcrunch only if user set flag in config
        filename = os.path.join(self.builddir, filename)
        self.bakery.logging_raw('### Fontcrunch {}\n'.format(filename))

        fontcrunch.optimize(filename, '{}.crunched'.format(filename))
        shutil.move('{}.crunched'.format(filename), filename)
        return 1
Exemple #3
0
    def run(self, pipedata):
        try:
            from fontcrunch import fontcrunch
        except ImportError:
            self.bakery.logging_raw(
                'Fontcruch is not installed. Please `pip install fontcrunch`')
            return

        if not pipedata.get('fontcrunch'):
            return  # run fontcrunch only if user set flag in config

        from bakery_cli.utils import ProcessedFile
        filename = ProcessedFile()

        filename = os.path.join(self.builddir, filename)
        self.bakery.logging_raw('### Fontcrunch {}\n'.format(filename))

        fontcrunch.optimize(filename, '{}.crunched'.format(filename))
        shutil.move('{}.crunched'.format(filename), filename)
        return 1