我在Wordpress上创建模板Angular 7。本地(http://localhost:4200)everthing它很好,但当我将构建ng --prod --output-path =“/ wp-content / themes / {theme_name} / dist /”它无法正常工作。我看不到图像 - img。我不写关于css生成的图像。这些工作正常。我不知道为什么。我的英语不太好。请冷静下来。
在“网络”选项卡中检查您的图像请求。检查请求文件的位置。请提供详细说明。
当涉及到请求。我得到500(内部服务器错误)。在Wordress中,相关路径是图像“/wp-content/themes/{theme_name}/assets/images/img/logo.png”。当我添加该路径时,我得到500(内部服务器错误)。我在angular.json中的片段。
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"assets": [
"src/assets"
],
我找到了解决问题的方法。 src中的链接必须类似于“/wp-content/themes/{theme_name}/dist/{image_name}.png”。