From b5ea1985699c3b9ee5f79caa9233c12cdd33410d Mon Sep 17 00:00:00 2001 From: Stanislas Michalak Date: Sat, 14 Apr 2018 21:51:48 +0200 Subject: [PATCH] Fix assets helpers * Fix #921: use webpack publicPath, instead of hard-coded "/assets/". --- generators/assets/webpack/templates/webpack.config.js.tmpl | 2 +- render/template_helpers.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/generators/assets/webpack/templates/webpack.config.js.tmpl b/generators/assets/webpack/templates/webpack.config.js.tmpl index 3ff8a9967..f13cb422b 100644 --- a/generators/assets/webpack/templates/webpack.config.js.tmpl +++ b/generators/assets/webpack/templates/webpack.config.js.tmpl @@ -75,7 +75,7 @@ const configurator = { var config = { mode: env, entry: configurator.entries(), - output: {filename: "[name].[hash].js", path: `${__dirname}/public/assets`}, + output: {filename: "[name].[hash].js", path: `${__dirname}/public/assets`, publicPath: "/assets/"}, plugins: configurator.plugins(), module: configurator.moduleOptions() } diff --git a/render/template_helpers.go b/render/template_helpers.go index 4346e0d0b..5ce7552bd 100644 --- a/render/template_helpers.go +++ b/render/template_helpers.go @@ -27,9 +27,9 @@ func assetPathFor(file string) string { filePath := assetMap[file] if filePath == "" { - filePath = file + filePath = filepath.Join("/assets", file) } - return filepath.ToSlash(filepath.Join("/assets", filePath)) + return filepath.ToSlash(filePath) } type helperTag struct {