Here is my index.html for posterity's sake:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<base href="/" />
<title>Cart</title>
<link href="content/external/bootstrap.css" rel="stylesheet" />
<link href="content/external/bootstrap-theme.css" rel="stylesheet" />
<link href="content/external/font-awesome.css" rel="stylesheet" />
<link href="content/external/angular-toastr.css" rel="stylesheet" />
</head>
<body ng-app>
{{3+4}}
drfg
<script src="scripts/external/jquery-1.9.1.js"></script>
<script src="scripts/external/bootstrap.js"></script>
<script src="scripts/external/angular.js"></script>
<script src="scripts/external/angular-ui-router.js"></script>
<script src="scripts/external/angular-resource.js"></script>
<script src="scripts/external/angular-mocks.js"></script>
<script src="scripts/external/angular-toastr.tpls.js"></script>
<script src="scripts/external/angular-animate.js"></script>
</body>
</html>
Whenever I hit run in webstorm to open in chrome, I get a 404 for every single javascript and css file. However, if I scope to the project directory and run node's http-server
, my site loads just fine. I can't seem to find anything in settings related to this. Any ideas?
By default, WebStorm shows on-the-fly preview only for HTML and CSS code. To enable Live Edit in JavaScript, select the JavaScript, HTML and CSS option.
To customize the parameters of the built-in web server, in the Settings/Preferences dialog ( Ctrl+Alt+S ), go to Build, Execution, Deployment | Debugger. Use this spin box to specify the port on which the built-in web server runs.
Alternatively, from the main menu, select Tools | Deployment | Configuration.... and select Local or mounted folder in the popup menu. In the Create new server dialog that opens, type the name of the server to create and click OK.
In the Settings/Preferences dialog ( Ctrl+Alt+S ), go to Build, Execution, Deployment | Debugger | Live Edit. On the Live Edit page that opens, select the Update application in Chrome on changes in checkbox. By default, IntelliJ IDEA shows on-the-fly preview only for HTML and CSS code.
the problem is caused by tag in index.html:
<base href="/"/>
that tells the browser to resolve all URLs in the page relative to the web server root (localhost:63342
when using built-in webserver). Obviously no resources can be found there, as the built-in webserver serves files from http://localhost:63342/<project root>
So, you need to comment out '<base href="/"/>
' to get your code working. Or, modify your hosts file to make webserver serve files from http://<some name>:63342
- see http://youtrack.jetbrains.com/issue/WEB-8988#comment=27-577559
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With