Frontend: Extract CSS imports into files (#94655)
* build(webpack): extract css imports into files including node_modules * feat(webassets): add cssfiles to entrypoint assets for extracted css files * feat(views): add entrypoint css link tags to html templates * feat(webassets): set CDN prefix for CSS files * test(webassets): trim down sample-assets-manifest, fix failing snapshot tests * Update pkg/api/webassets/webassets_test.go Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com> * build(webpack): remove css module loader --------- Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
This commit is contained in:
co-authored by
Marcus Efraimsson
parent
65fc7cf004
commit
cfb46c8003
@@ -134,10 +134,12 @@ func readWebAssets(r io.Reader) (*dtos.EntryPointAssets, error) {
|
||||
}
|
||||
|
||||
rsp := &dtos.EntryPointAssets{
|
||||
JSFiles: make([]dtos.EntryPointAsset, 0, len(entryPoints.App.Assets.JS)),
|
||||
Dark: entryPoints.Dark.Assets.CSS[0],
|
||||
Light: entryPoints.Light.Assets.CSS[0],
|
||||
Swagger: make([]dtos.EntryPointAsset, 0, len(entryPoints.Swagger.Assets.JS)),
|
||||
JSFiles: make([]dtos.EntryPointAsset, 0, len(entryPoints.App.Assets.JS)),
|
||||
CSSFiles: make([]dtos.EntryPointAsset, 0, len(entryPoints.App.Assets.CSS)),
|
||||
Dark: entryPoints.Dark.Assets.CSS[0],
|
||||
Light: entryPoints.Light.Assets.CSS[0],
|
||||
Swagger: make([]dtos.EntryPointAsset, 0, len(entryPoints.Swagger.Assets.JS)),
|
||||
SwaggerCSSFiles: make([]dtos.EntryPointAsset, 0, len(entryPoints.Swagger.Assets.CSS)),
|
||||
}
|
||||
|
||||
for _, entry := range entryPoints.App.Assets.JS {
|
||||
@@ -146,11 +148,23 @@ func readWebAssets(r io.Reader) (*dtos.EntryPointAssets, error) {
|
||||
Integrity: integrity[entry],
|
||||
})
|
||||
}
|
||||
for _, entry := range entryPoints.App.Assets.CSS {
|
||||
rsp.CSSFiles = append(rsp.CSSFiles, dtos.EntryPointAsset{
|
||||
FilePath: entry,
|
||||
Integrity: integrity[entry],
|
||||
})
|
||||
}
|
||||
for _, entry := range entryPoints.Swagger.Assets.JS {
|
||||
rsp.Swagger = append(rsp.Swagger, dtos.EntryPointAsset{
|
||||
FilePath: entry,
|
||||
Integrity: integrity[entry],
|
||||
})
|
||||
}
|
||||
for _, entry := range entryPoints.Swagger.Assets.CSS {
|
||||
rsp.SwaggerCSSFiles = append(rsp.SwaggerCSSFiles, dtos.EntryPointAsset{
|
||||
FilePath: entry,
|
||||
Integrity: integrity[entry],
|
||||
})
|
||||
}
|
||||
return rsp, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user