Reputation: 4749
I have an angular2 application which uses nodejs server api's.
I build the app using nd b, which created the files in dist folder. Where can I specify the production url for the production build, so that all the css, js files loads properly.
And also, whether I need apache server to host these build. Or Can I use node server itself to host it?
Index.html:
<!doctype html>
<html>
<head>
<base href="/">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Demo</title>
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="assets/styles/css/custom.css"/>
<script src="assets/vendor/pace/pace.js"></script>
</head>
<body>
<app-root>
<div class="loading"></div>
</app-root>
</body>
</html>
Thanks
Upvotes: 2
Views: 3104
Reputation: 2867
By analyzing your html file i am seeing an issue with the <base>
tag.
You need to provide ./
instead of /
which is wrong.
Corrected html document is given below.
<!doctype html>
<html>
<head>
<base href="./"> <!-- use ./ instead of / -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>SHEPHERD SHIELD</title>
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="assets/styles/css/custom.css"/>
<script src="assets/vendor/pace/pace.js"></script>
</head>
<body>
<app-root>
<div class="loading"></div>
</app-root>
</body>
</html>
Upvotes: 8
Reputation: 2867
For development and testing purpose you can specify the urls for the css from the dist folder. If you are going for production, then you can copy the minified version of css and js files and put them in style
and js
folders for example, also set the urls in the html file from these folders.
Upvotes: 2