Skip to content

Commit

Permalink
[ISSUE alibaba#8156] Add hash-tag for js and css (alibaba#8157)
Browse files Browse the repository at this point in the history
* [ISSUE alibaba#8156] Add hash-tag for js and css

- add index.html to copyList
- use index.ejs instead of index.html
- webpack enable hash

Close alibaba#8156

* [ISSUE alibaba#8156] Fix context-path error in development environment

Close alibaba#8156
  • Loading branch information
onewe authored Apr 20, 2022
1 parent 8838ae1 commit af90533
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 85 deletions.
2 changes: 1 addition & 1 deletion console-ui/build/copyFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const mkdir = dir => {
}
};

const copyList = ['js/main.js', 'css/main.css'];
const copyList = ['js/main.js', 'css/main.css', 'index.html'];

copyList.forEach(_fileName => {
const srcFileName = path.join(srcDir, _fileName);
Expand Down
6 changes: 5 additions & 1 deletion console-ui/build/webpack.base.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ module.exports = {
plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
template: './public/index.html',
template: './public/index.ejs',
templateParameters: {
contextPath: isDev ? './' : 'console-ui/public/'
},
hash: true,
minify: !isDev,
}),
new CopyWebpackPlugin([
Expand Down
61 changes: 61 additions & 0 deletions console-ui/public/index.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<!--
~ Copyright 1999-2018 Alibaba Group Holding Ltd.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<!DOCTYPE html>

<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<title>Nacos</title>
<link rel="shortcut icon" href="<%= contextPath %>img/nacos-logo.png" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="<%= contextPath %>css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="<%= contextPath %>css/console1412.css">
<!-- 第三方css开始 -->
<link rel="stylesheet" type="text/css" href="<%= contextPath %>css/codemirror.css">
<link rel="stylesheet" type="text/css" href="<%= contextPath %>css/merge.css">
<link rel="stylesheet" type="text/css" href="<%= contextPath %>css/icon.css">
<link rel="stylesheet" type="text/css" href="<%= contextPath %>css/font-awesome.css">
<!-- 第三方css结束 -->
</head>

<body>
<div id="root" style="overflow:hidden"></div>
<div id="app"></div>
<div id="other"></div>

<!-- 第三方js开始 -->
<script src="<%= contextPath %>js/jquery.js"></script>
<script src="<%= contextPath %>js/codemirror.js"></script>
<script src="<%= contextPath %>js/javascript.js"></script>
<script src="<%= contextPath %>js/xml.js"></script>
<script src="<%= contextPath %>js/codemirror.addone.fullscreen.js"></script>
<script src="<%= contextPath %>js/codemirror.addone.lint.js"></script>
<script src="<%= contextPath %>js/codemirror.lib.json-lint.js"></script>
<script src="<%= contextPath %>js/codemirror.addone.json-lint.js"></script>
<script src="<%= contextPath %>js/codemirror.lib.clike-lint.js"></script>
<script src="<%= contextPath %>js/diff_match_patch.js"></script>
<script src="<%= contextPath %>js/merge.js"></script>
<script src="<%= contextPath %>js/loader.js"></script>
<!-- 第三方js结束 -->
</body>

</html>
58 changes: 0 additions & 58 deletions console-ui/public/index.html

This file was deleted.

49 changes: 24 additions & 25 deletions console/src/main/resources/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,41 +22,40 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<title>Nacos</title>

<link rel="shortcut icon" href="console-ui/public/img/nacos-logo.png" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="console-ui/public/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="console-ui/public/css/console1412.css">
<link rel="shortcut icon" href="console-ui/public/img/nacos-logo.png" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="console-ui/public/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="console-ui/public/css/console1412.css">
<!-- 第三方css开始 -->

<link rel="stylesheet" type="text/css" href="console-ui/public/css/codemirror.css">
<link rel="stylesheet" type="text/css" href="console-ui/public/css/merge.css">
<link rel="stylesheet" type="text/css" href="console-ui/public/css/icon.css">
<link rel="stylesheet" type="text/css" href="console-ui/public/css/font-awesome.css">
<link rel="stylesheet" type="text/css" href="console-ui/public/css/codemirror.css">
<link rel="stylesheet" type="text/css" href="console-ui/public/css/merge.css">
<link rel="stylesheet" type="text/css" href="console-ui/public/css/icon.css">
<link rel="stylesheet" type="text/css" href="console-ui/public/css/font-awesome.css">
<!-- 第三方css结束 -->
<link href="css/main.css" rel="stylesheet">
</head>
<link href="./css/main.css?70f1002598390a0fe1c6" rel="stylesheet"></head>

<body>
<div id="root" style="overflow:hidden"></div>
<div id="app"></div>
<div id="other"></div>

<!-- 第三方js开始 -->
<script src="console-ui/public/js/jquery.js"></script>
<script src="console-ui/public/js/codemirror.js"></script>
<script src="console-ui/public/js/javascript.js"></script>
<script src="console-ui/public/js/xml.js"></script>
<script src="console-ui/public/js/codemirror.addone.fullscreen.js"></script>
<script src="console-ui/public/js/codemirror.addone.lint.js"></script>
<script src="console-ui/public/js/codemirror.lib.json-lint.js"></script>
<script src="console-ui/public/js/codemirror.addone.json-lint.js"></script>
<script src="console-ui/public/js/codemirror.lib.clike-lint.js"></script>
<script src="console-ui/public/js/diff_match_patch.js"></script>
<script src="console-ui/public/js/merge.js"></script>
<script src="console-ui/public/js/loader.js"></script>

<script src="console-ui/public/js/jquery.js"></script>
<script src="console-ui/public/js/codemirror.js"></script>
<script src="console-ui/public/js/javascript.js"></script>
<script src="console-ui/public/js/xml.js"></script>
<script src="console-ui/public/js/codemirror.addone.fullscreen.js"></script>
<script src="console-ui/public/js/codemirror.addone.lint.js"></script>
<script src="console-ui/public/js/codemirror.lib.json-lint.js"></script>
<script src="console-ui/public/js/codemirror.addone.json-lint.js"></script>
<script src="console-ui/public/js/codemirror.lib.clike-lint.js"></script>
<script src="console-ui/public/js/diff_match_patch.js"></script>
<script src="console-ui/public/js/merge.js"></script>
<script src="console-ui/public/js/loader.js"></script>
<!-- 第三方js结束 -->
<script type="text/javascript" src="js/main.js"></script></body>
<script type="text/javascript" src="./js/main.js?70f1002598390a0fe1c6"></script></body>

</html>

0 comments on commit af90533

Please sign in to comment.