Layout Function and Page Injector
Read this code first, Guess what it does.
ctx.Injector is for inject html into default layout's html head, and bottom of body.
html head normally for page title, keywords etc all kinds meta data, and css styles,
Next part describe about these asset references:
Created by using @vue/cli,
It does the basic functions like render server side returned html as vue templates.
Provide basic event functions that call to server, and manage push state
(change browser address urls before or after do ajax requests). do page partial refresh etc.
So that browser only need to request them one time. and cache them. The cache is set to the start
time of the process. So next time the app restarts, it invalid the cache.
For a new project:
- Use embed to pack them into Go code as
ComponentPack, which is a string
PacksHandlerto mount them as available http urls
- Write Layout function to reference them inside head, or bottom of body