{ "info": { "author": "Rocco Schulz", "author_email": "rocco@is-gr8.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3" ], "description": "# django-staticfiles-webpack\n\nSimple StaticFilesStorage that can be used together with the assets-webpack-plugin to include hashed files.\n\n## Why\n\nWebpack comes with an option to hash static files for long term caching so that generated files look like:\n\n - Main.76def765eff56.js (entry point)\n - Bundle.1.689ef7cbade76.js (loaded on demand)\n - Bundle.2.873426ef56a5e.js (loaded on demand)\n\nBundle files are usually a result of code splitting. Webpack keeps track of the filename changes for you, however the\nentry point files cannot be managed by Webpack easily when they need to be included in your Django templates.\n\nWhen the [assets-webpack-plugin](https://github.com/sporto/assets-webpack-plugin) is added to the webpack configuration, then a json file is created which maps entry points\nto generated file names.\nThis json file is read by the custom django staticfiles storage class to resolve the url for the entry point.\n\n\n## Webpack Configuration\n\nInstall the assets plugin with `npm install --save-dev assets-webpack-plugin`\nand include it in the plugins section of `webpack.conf.js`:\n\n```javascript\nAssetsPlugin = require('assets-webpack-plugin');\nvar entry = ['.src/app/App.js']\n \nmodule.exports = {\n\n output = {\n path: __dirname,\n filename: 'App.[name].[hash].js',\n chunkFilename: \"App.[id].[chunkhash].js\",\n publicPath: '/static/'\n };\nplugins: [\n new AssetsPlugin() // writes webpack-assets.json file that can be read in by custom django storage class\n],\n module\n:\n{\n loaders: [\n {test: /\\.js?$/, exclude: /node_modules/, loader: 'babel-loader'},\n //your other loaders ...\n ]\n}\n```\n\nWhen a build is completed, a `webpack-assets.json` file should be in the directory with a content like this:\n\n```javascript\n{\"main\":{\"js\":\"App.main.7ebdf0b55c648ba41cc1.js\"}}\n```\n\nNote that the entry point has been called 'main' as there was no name specified.\nWhen multiple entry points are defined in a dict, then each key is reflected in the assets.json.\nSee the webpack [docs](https://webpack.github.io/docs/multiple-entry-points.html).\n\n\n## Django Configuration\n\n### STATICFILES_STORAGE\nName of the storage class: `webpack.storage.WebpackHashStorage`\n\n### WEBPACK_ASSETS_FILE\nA path pointing to the generated webpack-assets.json file. E.g. `\"path-to-your/webpack-assets.json\"`\n\n\n## Need something more sophisticated?\nMaybe https://github.com/owais/django-webpack-loader suits your needs.\n", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/schocco/django-staticfiles-webpack/webpack/tarball/0.1", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/schocco/django-staticfiles-webpack", "keywords": "django,webpack,assets,build,static", "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "django-staticfiles-webpack", "package_url": "https://pypi.org/project/django-staticfiles-webpack/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-staticfiles-webpack/", "project_urls": { "Download": "https://github.com/schocco/django-staticfiles-webpack/webpack/tarball/0.1", "Homepage": "https://github.com/schocco/django-staticfiles-webpack" }, "release_url": "https://pypi.org/project/django-staticfiles-webpack/0.1/", "requires_dist": null, "requires_python": null, "summary": "Support for loading Webpack hashed files in Django templates via the static files app.", "version": "0.1" }, "last_serial": 1600637, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "ce386090e71790a5ff5bc2ce88e84a5b", "sha256": "eb97185820b92ac110a6542a65973881b3996a6ebd506bce07a29c21ff4711b5" }, "downloads": -1, "filename": "django-staticfiles-webpack-0.1.tar.gz", "has_sig": false, "md5_digest": "ce386090e71790a5ff5bc2ce88e84a5b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2886, "upload_time": "2015-06-21T09:10:43", "url": "https://files.pythonhosted.org/packages/48/b7/d0d01ed5feddf864b09bab79acf54ab163380e93ac58957e49247635fc6e/django-staticfiles-webpack-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ce386090e71790a5ff5bc2ce88e84a5b", "sha256": "eb97185820b92ac110a6542a65973881b3996a6ebd506bce07a29c21ff4711b5" }, "downloads": -1, "filename": "django-staticfiles-webpack-0.1.tar.gz", "has_sig": false, "md5_digest": "ce386090e71790a5ff5bc2ce88e84a5b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2886, "upload_time": "2015-06-21T09:10:43", "url": "https://files.pythonhosted.org/packages/48/b7/d0d01ed5feddf864b09bab79acf54ab163380e93ac58957e49247635fc6e/django-staticfiles-webpack-0.1.tar.gz" } ] }