This assets/ directory should contain original JS and CSS source
files that are used in the project. These files will be
minified and copied to the public/ directory whenever the project is built.
When adding new JS or CSS the following steps will need to be followed.
- Add the new file to the assets/js or assets/css directory.
- Add the named file to /runner/runner.go so the asset will be minified
and copied to the public/ directory.
- Create two new consts for the new file paths in handler/app/app.go.
- Create a new key in the SRI type struct in handler/app/app.go.
- Create a new Verify function result in handler/app/app.go.
- Create a new route in handler/router.go.
- Create a new TemplateFuncMap entry in handler/app/funcmap.go.
- In the view/app/layout.tmpl file, add a new
An example for a new.js file:
- assets/js/new.js
- newJS := api.Build(api.BuildOptions{...})
- NewJS = "/js/new.min.js"
NewPub = public + NewJS
- type SRI struct { ... NewSRI string }
- s.NewJS, err = helper.Integrity(NewPub, fs)
- e.FileFS(app.NewJS, app.NewPub, public)
- "sriNew": func() string { return web.Subresource.NewJS },
"newjs": func() string { return NewJS },
-