Commit 57bf7203 authored by Jesse Hallam's avatar Jesse Hallam Committed by Sudheer

subpath: rewrite manifest.json too (#9017)

parent 4b2a6263
......@@ -89,14 +89,14 @@ func UpdateAssetsSubpath(subpath string) error {
return errors.Wrapf(err, "failed to update root.html with subpath %s", subpath)
}
// Rewrite the *.css references to `/static/*` (or a previously rewritten subpath).
// Rewrite the manifest.json and *.css references to `/static/*` (or a previously rewritten subpath).
err = filepath.Walk(staticDir, func(walkPath string, info os.FileInfo, err error) error {
if filepath.Ext(walkPath) == ".css" {
if oldCss, err := ioutil.ReadFile(walkPath); err != nil {
if filepath.Base(walkPath) == "manifest.json" || filepath.Ext(walkPath) == ".css" {
if old, err := ioutil.ReadFile(walkPath); err != nil {
return errors.Wrapf(err, "failed to open %s", walkPath)
} else {
newCss := strings.Replace(string(oldCss), pathToReplace, newPath, -1)
if err = ioutil.WriteFile(walkPath, []byte(newCss), 0); err != nil {
new := strings.Replace(string(old), pathToReplace, newPath, -1)
if err = ioutil.WriteFile(walkPath, []byte(new), 0); err != nil {
return errors.Wrapf(err, "failed to update %s with subpath %s", walkPath, subpath)
}
}
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment