Skip to main content

Transparently use webpack with flask

Project description

flask-webpack-loader

flask version django-webpack-loader

Install

npm install --save-dev webpack-bundle-tracker

pip install flask-webpack-loader

Usage

app.py

from flask_webpack_loader import WebpackLoader

webpack_loader = WebpackLoader(app)

template.html

    {{ render_bundle('main') | safe }}
    
    # webpack 4+
    {{ render_bundle('runtime~main') | safe }}
    {{ render_bundle('undefined') | safe }}

Configuration

WEBPACK_LOADER = {
    'BUNDLE_DIR_NAME': os.path.join('static', 'bundles'),
    'STATIC_URL': 'static',
    'STATS_FILE': 'webpack-stats.prod.json',
    'POLL_INTERVAL': 0.1,
    'TIMEOUT': None,
    'IGNORES': [re.compile(r'.+\.hot-update.js'), re.compile(r'.+\.map')]
}

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

flask-webpack-loader-0.0.4.tar.gz (4.5 kB view hashes)

Uploaded Source

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