Replace webassets with a simple static view and YAML config loader
After replacing the asset build pipeline with Gulp, webassets' only function was to generate URLs for files defined in named bundles and add cache-busting query strings. It wasn't doing the latter because webassets does not generate cache-busting query strings for files it serves unless at least one filter is used or an output path is defined. This commit replaces webassets with a Pyramid static view and a small custom asset config environment, h.assets.Environment. h.assets.Environment reads a set of named bundles defined in the h/assets.yaml config file and a JSON manifest which maps file paths to URLs with cache-busting query strings, generated by the Gulp build process. In the process, the logic for adding CORS headers to static asset requests has been rewritten to 1) Explain _why_ a CORS header is needed and 2) Add the headers in a way that doesn't rely on internal details of how Pyramid works. pyramid.static.static_view is used directly rather than config.add_static_view() because add_static_view() does not provide a way to decorate requests in order to add the CORS header. See https://github.com/Pylons/pyramid/issues/1486
Showing
... | ... | @@ -53,8 +53,10 @@ |
"devDependencies": { | ||
"chai": "^3.2.0", | ||
"compass-mixins": "^0.12.7", | ||
"end-of-stream": "^1.1.0", | ||
"exorcist": "^0.4.0", | ||
"gulp": "^3.9.1", | ||
"gulp-batch": "^1.0.5", | ||
"gulp-changed": "^1.3.0", | ||
"gulp-cli": "^1.2.1", | ||
"gulp-if": "^2.0.0", | ||
... | ... | @@ -78,7 +80,9 @@ |
"proxyquire": "^1.6.0", | ||
"proxyquire-universal": "^1.0.8", | ||
"proxyquireify": "^3.0.0", | ||
"run-sequence": "^1.1.5", | ||
"sinon": "1.16.1", | ||
"through2": "^2.0.1", | ||
"uglifyify": "^3.0.1", | ||
"watchify": "^3.7.0", | ||
"whatwg-fetch": "^0.10.1" | ||
... | ... |
scripts/gulp/manifest.js
0 → 100644
Please register or sign in to comment