Skip to content
This repository has been archived by the owner on Feb 28, 2022. It is now read-only.

Commit

Permalink
fix(static): change extension from .esi to .esi
Browse files Browse the repository at this point in the history
  • Loading branch information
trieloff committed Apr 30, 2019
1 parent 59665f7 commit a936918
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/html/static-asset-links.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function scripts() {
const src = new Url(node.properties.src);
if (src.host === '' && src.query === '' && src.pathname) {
// eslint-disable-next-line no-param-reassign
node.properties.src = `<esi:include src="${src.pathname}.esi"/><esi:remove>${node.properties.src}</esi:remove>`;
node.properties.src = `<esi:include src="${src.pathname}.url"/><esi:remove>${node.properties.src}</esi:remove>`;
}
}
});
Expand All @@ -41,7 +41,7 @@ function links() {
const href = new Url(node.properties.href);
if (href.host === '' && href.query === '' && href.pathname) {
// eslint-disable-next-line no-param-reassign
node.properties.href = `<esi:include src="${href.pathname}.esi"/><esi:remove>${node.properties.href}</esi:remove>`;
node.properties.href = `<esi:include src="${href.pathname}.url"/><esi:remove>${node.properties.href}</esi:remove>`;
}
}
});
Expand Down
8 changes: 4 additions & 4 deletions test/testRewriteStatic.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ describe('Integration Test Static Asset Rewriting', () => {

assert.equal(res.response.body, `<html><head>
<title>Hello World</title>
<script src='<esi:include src="index.js.esi"/><esi:remove>index.js</esi:remove>'></script>
<link rel="stylesheet" href='<esi:include src="style.css.esi"/><esi:remove>style.css</esi:remove>'>
<script src='<esi:include src="index.js.url"/><esi:remove>index.js</esi:remove>'></script>
<link rel="stylesheet" href='<esi:include src="style.css.url"/><esi:remove>style.css</esi:remove>'>
</head>
<body>
<p>Hello World</p>
Expand Down Expand Up @@ -148,7 +148,7 @@ describe('Test Static Asset Rewriting', () => {
<body>Just normal things
</body></html>`), `<!doctype html><html><head>
<title>Normal</title>
<script src='<esi:include src="test.js.esi"/><esi:remove>test.js</esi:remove>'></script>
<script src='<esi:include src="test.js.url"/><esi:remove>test.js</esi:remove>'></script>
<script src="keep.js?cached=false"></script>
<script src="//code.jquery.com/jquery-3.4.0.min.js"></script>
</head>
Expand All @@ -166,7 +166,7 @@ describe('Test Static Asset Rewriting', () => {
<body>Just normal things
</body></html>`), `<!doctype html><html><head>
<title>Normal</title>
<link rel="stylesheet foo" href='<esi:include src="test.css.esi"/><esi:remove>test.css</esi:remove>'>
<link rel="stylesheet foo" href='<esi:include src="test.css.url"/><esi:remove>test.css</esi:remove>'>
<link rel="stylesheet" href="keep.css?cached=false">
<link rel="stylesheet" href="//code.jquery.com/jquery-3.4.0.min.css">
</head>
Expand Down

0 comments on commit a936918

Please sign in to comment.