Fix urlPath support, let CodiMD be served from a subpath correctly
Webpack now uses relative paths for resources linked from by static snippets. A templated <base> tag has been introduced in headers so app.js can set the base URL at runtime. Signed-off-by: Enrico Guiraud <enrico.guiraud@cern.ch>
This commit is contained in:
		
							parent
							
								
									313eb74ed6
								
							
						
					
					
						commit
						23c7b5b0a6
					
				@ -12,6 +12,7 @@
 | 
				
			|||||||
<meta property="og:image:alt" content="CodiMD logo">
 | 
					<meta property="og:image:alt" content="CodiMD logo">
 | 
				
			||||||
<meta property="og:image:type" content="image/png">
 | 
					<meta property="og:image:type" content="image/png">
 | 
				
			||||||
<% } %>
 | 
					<% } %>
 | 
				
			||||||
 | 
					<base href="<%- serverURL %>/">
 | 
				
			||||||
<title><%= title %></title>
 | 
					<title><%= title %></title>
 | 
				
			||||||
<link rel="icon" type="image/png" href="<%- serverURL %>/favicon.png">
 | 
					<link rel="icon" type="image/png" href="<%- serverURL %>/favicon.png">
 | 
				
			||||||
<link rel="apple-touch-icon" href="<%- serverURL %>/apple-touch-icon.png">
 | 
					<link rel="apple-touch-icon" href="<%- serverURL %>/apple-touch-icon.png">
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,3 @@
 | 
				
			|||||||
<% for (var css in htmlWebpackPlugin.files.css) { %>
 | 
					<% for (var css in htmlWebpackPlugin.files.css) { %>
 | 
				
			||||||
<link href="<%= webpackConfig.output.baseUrl %><%= htmlWebpackPlugin.files.css[css] %>" rel="stylesheet">
 | 
					<link href="<%= htmlWebpackPlugin.files.css[css] %>" rel="stylesheet">
 | 
				
			||||||
<% } %>
 | 
					<% } %>
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
<script src="<%= webpackConfig.output.baseUrl %>/config"></script>
 | 
					<script src="config"></script>
 | 
				
			||||||
<% for (var js in htmlWebpackPlugin.files.js) { %>
 | 
					<% for (var js in htmlWebpackPlugin.files.js) { %>
 | 
				
			||||||
<script src="<%= webpackConfig.output.baseUrl %><%= htmlWebpackPlugin.files.js[js] %>" defer></script>
 | 
					<script src="<%= htmlWebpackPlugin.files.js[js] %>" defer></script>
 | 
				
			||||||
<% } %>
 | 
					<% } %>
 | 
				
			||||||
 | 
				
			|||||||
@ -13,6 +13,7 @@
 | 
				
			|||||||
<meta property="og:image" content="<%- serverURL %>/codimd-icon-1024.png">
 | 
					<meta property="og:image" content="<%- serverURL %>/codimd-icon-1024.png">
 | 
				
			||||||
<meta property="og:image:alt" content="CodiMD logo">
 | 
					<meta property="og:image:alt" content="CodiMD logo">
 | 
				
			||||||
<meta property="og:image:type" content="image/png">
 | 
					<meta property="og:image:type" content="image/png">
 | 
				
			||||||
 | 
					<base href="<%- serverURL %>/">
 | 
				
			||||||
<title>CodiMD - <%= __('Collaborative markdown notes') %></title>
 | 
					<title>CodiMD - <%= __('Collaborative markdown notes') %></title>
 | 
				
			||||||
<link rel="icon" type="image/png" href="<%- serverURL %>/favicon.png">
 | 
					<link rel="icon" type="image/png" href="<%- serverURL %>/favicon.png">
 | 
				
			||||||
<link rel="apple-touch-icon" href="<%- serverURL %>/apple-touch-icon.png">
 | 
					<link rel="apple-touch-icon" href="<%- serverURL %>/apple-touch-icon.png">
 | 
				
			||||||
 | 
				
			|||||||
@ -22,6 +22,7 @@
 | 
				
			|||||||
    <meta property="og:image:alt" content="CodiMD logo">
 | 
					    <meta property="og:image:alt" content="CodiMD logo">
 | 
				
			||||||
    <meta property="og:image:type" content="image/png">
 | 
					    <meta property="og:image:type" content="image/png">
 | 
				
			||||||
    <% } %>
 | 
					    <% } %>
 | 
				
			||||||
 | 
					    <base href="<%- serverURL %>/">
 | 
				
			||||||
    <title><%= title %></title>
 | 
					    <title><%= title %></title>
 | 
				
			||||||
    <link rel="icon" type="image/png" href="<%- serverURL %>/favicon.png">
 | 
					    <link rel="icon" type="image/png" href="<%- serverURL %>/favicon.png">
 | 
				
			||||||
    <link rel="apple-touch-icon" href="<%- serverURL %>/apple-touch-icon.png">
 | 
					    <link rel="apple-touch-icon" href="<%- serverURL %>/apple-touch-icon.png">
 | 
				
			||||||
 | 
				
			|||||||
@ -11,6 +11,7 @@
 | 
				
			|||||||
        <% if(typeof description !== 'undefined' && description) { %>
 | 
					        <% if(typeof description !== 'undefined' && description) { %>
 | 
				
			||||||
        <meta name="description" content="<%= description %>">
 | 
					        <meta name="description" content="<%= description %>">
 | 
				
			||||||
        <% } %>
 | 
					        <% } %>
 | 
				
			||||||
 | 
					        <base href="<%- serverURL %>/">
 | 
				
			||||||
        <title><%= title %></title>
 | 
					        <title><%= title %></title>
 | 
				
			||||||
        <link rel="icon" type="image/png" href="<%- serverURL %>/favicon.png">
 | 
					        <link rel="icon" type="image/png" href="<%- serverURL %>/favicon.png">
 | 
				
			||||||
        <link rel="apple-touch-icon" href="<%- serverURL %>/apple-touch-icon.png">
 | 
					        <link rel="apple-touch-icon" href="<%- serverURL %>/apple-touch-icon.png">
 | 
				
			||||||
 | 
				
			|||||||
@ -352,7 +352,7 @@ module.exports = {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  output: {
 | 
					  output: {
 | 
				
			||||||
    path: path.join(__dirname, 'public/build'),
 | 
					    path: path.join(__dirname, 'public/build'),
 | 
				
			||||||
    publicPath: '/build/',
 | 
					    publicPath: 'build/',
 | 
				
			||||||
    filename: '[name].js'
 | 
					    filename: '[name].js'
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -14,7 +14,7 @@ module.exports = {
 | 
				
			|||||||
  },
 | 
					  },
 | 
				
			||||||
  output: {
 | 
					  output: {
 | 
				
			||||||
    path: path.join(__dirname, 'public/build'),
 | 
					    path: path.join(__dirname, 'public/build'),
 | 
				
			||||||
    publicPath: '/build/',
 | 
					    publicPath: 'build/',
 | 
				
			||||||
    filename: '[name].js'
 | 
					    filename: '[name].js'
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  plugins: [
 | 
					  plugins: [
 | 
				
			||||||
 | 
				
			|||||||
@ -9,7 +9,7 @@ module.exports = [
 | 
				
			|||||||
    mode: 'production',
 | 
					    mode: 'production',
 | 
				
			||||||
    output: {
 | 
					    output: {
 | 
				
			||||||
      path: path.join(__dirname, 'public/build'),
 | 
					      path: path.join(__dirname, 'public/build'),
 | 
				
			||||||
      publicPath: '/build/',
 | 
					      publicPath: 'build/',
 | 
				
			||||||
      filename: '[name].[contenthash].js'
 | 
					      filename: '[name].[contenthash].js'
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }),
 | 
					  }),
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user