Skip to main content

Bundles multiple css/js files into one and reduce request time

Project description

JS/CSS Bundle

Bundles multiple css or js files into one to reduce worker load for development server (flask) or webserver (nginx) connections

Usage

from flask import Flask
from static_bundle import register_extension

app = Flask(__name__, static_folder='static')

register_extension(app)
{% bundler 'cache/vendor.css' %}
    <link rel="stylesheet" type="text/css"
          href="{{ file_path_for('static', filename = 'fontawesome-free-5.7.1-web/css/fontawesome.min.css') }}">
        
    <link rel="stylesheet" type="text/css"
          href="{{ file_path_for('static', filename = 'css/bootstrap_table_1.18.3/bootstrap-table.css') }}">
    <link rel="stylesheet" type="text/css"
          href="{{ file_path_for('static', filename = 'css/bootstrap_table_1.18.3/extensions/filter-control/bootstrap-table-filter-control.css') }}">
    <link rel="stylesheet" type="text/css" href="{{ file_path_for('static', filename = 'css/datetime_picker_css.css') }}">

{% endbundler %}

This will generate cache/vendor.css inside static folder and generate final output like below

<link rel="stylesheet" type="text/css" href="/static/cache/vendor.css">

Please create github issue if you encounter any problem.

Checklist Items for future

  • Add support for Django & FastAPI
  • Add support to minify content

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

static-bundler-0.0.2.tar.gz (5.2 kB view hashes)

Uploaded Source

Built Distribution

static_bundler-0.0.2-py3-none-any.whl (5.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page