def render(self, context): if not getattr(settings, 'JC_MAKE_COMPRESS', False): return '' path = self.script_path.resolve(context) fullpath = os.path.join(settings.MEDIA_ROOT, path) if not os.path.exists(fullpath): os.makedirs(fullpath) compressor = JCCompressor.init(fullpath, self.scriptype, context.get('jccompressor__%s' % (self.scriptype,), [])) compressor.set_combined(getattr(settings, 'JC_ONLY_COMBINING', False)) compressor.process(version = str(getattr(settings, 'JC_SCRIPTS_VERSION', ''))) return getattr(self, 'render__%s' % (self.scriptype,))('build/' + compressor.output_filename, context)
def make_compiled(self, mediatype, items): media_urls = [] for item in items: filename = item if not self._with_ext: filename = '%s.%s' % (item, mediatype) url = self.get_media_url(filename, mediatype) media_urls.append(url) fullpath = JC_MEDIA_ROOT if not os.path.exists(fullpath): os.makedirs(fullpath) compressor = JCCompressor.init(fullpath, mediatype, media_urls, []) compressor.set_combined(combined=self.combined) compressor.process(version=self.version, forcebuild=self.forcebuild) return settings.COMPRESSED_MEDIA_URL + compressor.output_filename
def make_compiled(self, mediatype, items): media_urls = [] for item in items: filename = '%s.%s' % (item, mediatype) url = self.get_media_url(filename, mediatype, prefix=settings.MEDIA_ROOT) media_urls.append(url) fullpath = JC_MEDIA_ROOT if not os.path.exists(fullpath): os.makedirs(fullpath) compressor = JCCompressor.init(fullpath, mediatype, media_urls, []) compressor.set_combined( combined = getattr(settings, 'JC_ONLY_COMBINING', False)) compressor.process( version = str(getattr(settings, 'JC_SCRIPTS_VERSION', '')), forcebuild = getattr(settings, 'JC_FORCE_BUILD', False)) return settings.COMPRESSED_MEDIA_URL + compressor.output_filename