示例#1
0
文件: helpers.py 项目: Beachy13/kuma
def js_url_array(bundle, debug=None):
    """
    Return a JS array of the URLS for a minified and bundled JS file.

    In production, the array will have one item, the URL of the minified,
    bundled JS file.  In development, each bundled item will be present, and
    it will be the unminified versions.

    For example, in production, 'main' returns CDN paths like:
    ["https://developer.cdn.mozilla.net/static/js/main-min.js?build=97c12a9"]

    In development, 'main' returns local paths like:
    [
      "/static/js/libs/jquery-2.1.0.js?build=1443476862,
      "/static/js/components.js?build=1443476862",
      "/static/js/analytics.js?build=1443476862",
      "/static/js/main.js?build=1443476862",
      "/static/js/auth.js?build=1443476862",
      "/static/js/libs/fontfaceobserver/" +
        "fontfaceobserver-standalone.js?build=1443476862",
      "/static/js/fonts.js?build=1443476862"
    ]
    """
    return asset_url_array(get_js_urls(bundle, debug))
示例#2
0
def js_url_array(bundle, debug=None):
    """
    Return a JS array of the URLS for a minified and bundled JS file.

    In production, the array will have one item, the URL of the minified,
    bundled JS file.  In development, each bundled item will be present, and
    it will be the unminified versions.

    For example, in production, 'main' returns CDN paths like:
    ["https://developer.cdn.mozilla.net/static/js/main-min.js?build=97c12a9"]

    In development, 'main' returns local paths like:
    [
      "/static/js/libs/jquery-2.1.0.js?build=1443476862,
      "/static/js/components.js?build=1443476862",
      "/static/js/analytics.js?build=1443476862",
      "/static/js/main.js?build=1443476862",
      "/static/js/auth.js?build=1443476862",
      "/static/js/libs/fontfaceobserver/" +
        "fontfaceobserver-standalone.js?build=1443476862",
      "/static/js/fonts.js?build=1443476862"
    ]
    """
    return asset_url_array(get_js_urls(bundle, debug))
示例#3
0
def js_urls_json(bundle):
    """Return a JSON list of the URLs for the requested asset bundle."""
    return json.dumps(get_js_urls(bundle))