Skip to main content

CDN Assets

This package help you to use CDN Assets instead of downloading js and css by your self.

Quick start

  1. Install this package:

    pip install cdn_assets

  2. Add “cdn-assets” to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...
        'cdn_assets',
    ]
  3. Using filter we provide like this:

    {% load cdn_assets %}
    
    {% cdn bootcss %}
        {% asset bootstrap 3.3.5 css bootstrap.min css %}
        {% asset jquery 2.2.1 jquery.min js %}
    {% endcdn %}
    
    
    This will output ::
    <script src="//cdn.bootcss.com/jquery/2.2.1/jquery.min.js"></script>
    <link href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
    
    Explaination ::
    {% cdn bootcss %}
        {% asset jquery 2.2.1 jquery.min js %}
    {% endcdn %}
    The last parameter for asset filter is js, It would generate <script>
    If the last parameter is css, then it would be <link rel='stylesheet'>
    '/'.join() jquery 2.2.1 jquery.min -> jquery/2.2.1/jquery.min
    adding the js it becomes jquery/2.2.1/jquery.min.js
    The host is bootcss, so the url would be //cdn.bootcss.com/jquery/2.2.1/jquery.min.js
  4. CDN Host list:

    HOST_MAPPINGS = {
        'bootcss':      'cdn.bootcss.com',
        'baidu':        'libs.baidu.com',
        'sinaapp':      'lib.sinaapp.com',
        'aspnetcdn':    'jax.aspnetcdn.com',
        'google':       'ajax.googleapis.com',
        'upai':         'upcdn.b0.upaiyun.com',
        'cdnjs':        'cdnjs.cloudflare.com',
        'staticfile':   'cdn.staticfile.org',
        '360':          'libs.useso.com'
    }

Metadata

Release files for cdn_assets 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cdn_assets 0.2.3
File Size Uploaded Provenance Actions
cdn_assets-0.2.3.tar.gz 4.1 kB Without provenance Details for cdn_assets-0.2.3.tar.gz

Release files / cdn_assets-0.2.3.tar.gz

Download URL cdn_assets-0.2.3.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3ee76fc680eaf5aa9b88516924510b06253246420332ae8951e051b02e45d839
BLAKE2b-256 checksum
How to use checksums
2fcfd303dbd0cc671fcb8fc18bf66858ca09b5697e38a6dbc424814c67f2e6e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for cdn_assets 0.2.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.3 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page