Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix static urls for public path with a custom path and templates statics

NyanKiyoshibe8784258b70
diff --git a/templates/dashboard/includes/_filters.html b/templates/dashboard/includes/_filters.html
index 425e6a5123..6ff2ad1b98 100644
--- a/templates/dashboard/includes/_filters.html
+++ b/templates/dashboard/includes/_filters.html
@@ -9,7 +9,7 @@
<div class="col s12">
<span class="card-title">{% trans 'Filters' context 'Dashboard card title' %}</span>
{{ filter.get_summary_message }}
- <span class="collapse-activate hide-on-large-only"><svg data-src="{% static '/images/filter-icon.svg' %}" /></span>
+ <span class="collapse-activate hide-on-large-only"><svg data-src="{% static 'images/filter-icon.svg' %}" /></span>
</div>
<div class="col s12 hide-on-large-only chips-container">
{% for chip in chips %}
diff --git a/templates/dashboard/order/pdf/invoice.html b/templates/dashboard/order/pdf/invoice.html
index 1f483c24b4..6bd37fb562 100644
--- a/templates/dashboard/order/pdf/invoice.html
+++ b/templates/dashboard/order/pdf/invoice.html
@@ -11,7 +11,7 @@
<body>
<header>
<div style="float:left">
- <img src="{% static '/images/logo-document.svg' %}">
+ <img src="{% static 'images/logo-document.svg' %}">
</div>
<div
style="float:right">{{ order.created }}<br>{% trans 'Order' context 'Invoice header' %} #{{ order.id }}
diff --git a/templates/dashboard/order/pdf/packing_slip.html b/templates/dashboard/order/pdf/packing_slip.html
index 0f32b9b42f..acbf75826a 100644
--- a/templates/dashboard/order/pdf/packing_slip.html
+++ b/templates/dashboard/order/pdf/packing_slip.html
@@ -10,7 +10,7 @@
<body>
<header>
<div style="float:left">
- <img src="{% static '/images/logo-document.svg' %}">
+ <img src="{% static 'images/logo-document.svg' %}">
</div>
<div
style="float:right">{{ order.created }}<br>{% trans "Order ID:" context "Packing slip header" %} {{ order.id }}
diff --git a/webpack.config.js b/webpack.config.js
index 5ce2f2fad4..bba62c8c17 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -1,6 +1,7 @@
var BundleTracker = require('webpack-bundle-tracker');
var MiniCssExtractPlugin = require('mini-css-extract-plugin');
var path = require('path');
+var url = require('url');
var webpack = require('webpack');
var autoprefixer = require('autoprefixer');
@@ -11,11 +12,13 @@ var fileLoaderPath;
var output;
if (process.env.NODE_ENV === 'production') {
+ const baseStaticPath = process.env.STATIC_URL || '/static/';
+ const publicPath = url.resolve(baseStaticPath, 'assets/');
output = {
path: resolve('saleor/static/assets/'),
filename: '[name].[chunkhash].js',
chunkFilename: '[name].[chunkhash].js',
- publicPath: process.env.STATIC_URL || '/static/assets/'
+ publicPath: publicPath
};
fileLoaderPath = 'file-loader?name=[name].[hash].[ext]';
extractCssPlugin = new MiniCssExtractPlugin({