Esempio n. 1
0
    def render(self, context):
        media_url = self.get_media_url(context)

        if SERVE_REMOTE and self.path in JOINED:
            # Serving from S3/Cloud Files.
            return self.scripttag(media_url, JS_PATH, self.path)
        elif not SERVE_REMOTE and EMULATE_COMBO:
            # Don't split the combo file into its component files. Emulate
            # the combo behavior, but generate/serve it locally. Useful for
            # testing combo JS before deploying.
            return self.scripttag(media_url, JS_PATH, self.path)
        else:
            # If this is a combo file seen in the JOINED key on the
            # MEDIASYNC dict, break it apart into its component files and
            # write separate <link> tags for each.
            filenames = JOINED.get(self.path, (self.path,))
            return ' '.join((self.scripttag(media_url, JS_PATH, fn) for fn in filenames))