Skip to content

Serve all static assets from the same root directory#891

Merged
outoftime merged 1 commit intopopcodeorg:masterfrom
outoftime:dist
Jul 3, 2017
Merged

Serve all static assets from the same root directory#891
outoftime merged 1 commit intopopcodeorg:masterfrom
outoftime:dist

Conversation

@outoftime
Copy link
Copy Markdown
Contributor

Previously assets were served from the static/ directory; at the root of this directory were unmodified static files that were part of version control, e.g. index.html. This contained static/compiled/, which contained compiled files (CSS bundle, JS bundle, etc.) and was not under version control.

Now all assets are served from the dist directory in the root of the project; static has moved to src/static.

The proximate motivation for this is that service workers can’t control files outside of the directory they are served from; so, serving a service worker from /compiled/sw.js prevented that service worker from caching /index.html. This can be overridden with a header, but since we serve the site statically from S3, that’s not so simple.

This change also I think is strictly more sensible.

Previously assets were served from the `static/` directory; at the root
of this directory were unmodified static files that were part of version
control, e.g. `index.html`. This contained `static/compiled/`, which
contained compiled files (CSS bundle, JS bundle, etc.) and was not under
version control.

Now all assets are served from the `dist` directory in the root of the
project; `static` has moved to `src/static`.

The proximate motivation for this is that service workers can’t control
files outside of the directory they are served from; so, serving a
service worker from `/compiled/sw.js` prevented that service worker from
caching `/index.html`. This can be overridden with a header, but since
we serve the site statically from S3, that’s not so simple.

This change also I think is strictly more sensible.
@outoftime outoftime merged commit d25c1af into popcodeorg:master Jul 3, 2017
@outoftime outoftime deleted the dist branch July 3, 2017 01:27
@outoftime outoftime mentioned this pull request Jul 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant