Update file extensions for backend scripts

This commit is contained in:
Max 2024-08-01 18:43:15 +08:00
parent fc1f80e0f5
commit 44eb60377d
2 changed files with 5 additions and 3 deletions

View file

@ -63,9 +63,11 @@ func LoadScript(file string, disableCache ...bool) (*Script, error) {
}
}
file = base + ".ts"
file = base + ".backend.ts"
fmt.Println(file)
if exist, _ := application.App.Exists(file); !exist {
file = base + ".js"
file = base + ".backend.js"
}
if exist, _ := application.App.Exists(file); !exist {

View file

@ -692,7 +692,7 @@ func (page *Page) writeBackendScript(data map[string]interface{}) error {
}
ext := filepath.Ext(file)
scriptFile := fmt.Sprintf("%s%s", page.publicFile(data), ext)
scriptFile := fmt.Sprintf("%s.backend%s", page.publicFile(data), ext)
scriptFileAbs := filepath.Join(application.App.Root(), scriptFile)
dir := filepath.Dir(scriptFileAbs)
if exist, _ := os.Stat(dir); exist == nil {