The Legwork 2018 Site
## Start Docker
docker-compose up
The site will be served at http://localhost:8080.
We are using Server Side Rendering and prefetching all data to ensure speedy delivery of the site and content.
- Day-to-day dev work should happen on the
dev
branch or a feature branch that is merged into dev. - The
staging
branch should be kept up to date with staging. - The
master
branch should be kept up to date with production.
app.vue
- The main App rootviews
- Holds all components that are only used once ( if it's on every page it goes here. )- Each of the components will be present at all times and we are want to avoid re-rendering big parts of the dom.
util
- Utitlity classesstyles
- These are general global stylesstore
- Vuex storerouter
- The routercomponents
- These are sub components and are reused in multiple primary views.api
- The API for the server and pre-rendering.
- Add the module to
package.json
- Take docker down
crtl+c
anddocker-compose down
- Run
docker-compose build builder
- Run
docker-compose up
For the SSR we have a JSON file that is cached in production coming from our CMS. On initial load after a deployment is run the server will cache the data from this JSON file and use to render pages serverside before the app initializes.
Our store and app state are already setup when the site renders and Vue takes over on the frontend. You can see more of this in the following areas:
src/api/index.js
- Fetches the data from s3 and returns as a promise.
src/store/actions.js:10
- Makes the call to api index to fetch data and commits to the store.
src/store/mutations.js:11
- Makes the change to the store from
actions.js
- Makes the change to the store from
src/entry-server.js
- Calles
ssrInit()
on components listed in the routes which initializes on the serverside. - This is where the initial fetch projects is called from.
- Calles