Reputation: 763
I am trying to build an ember app with ember-cli. I created the app with ember new HelloWorld
and built it with ember build
. Inside the "dist"-Folder is a index.html with this Markup:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>HelloWorld</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<base href="/" />
<meta name="hello-world/config/environment" content="..." />
<link rel="stylesheet" href="assets/vendor.css">
<link rel="stylesheet" href="assets/hello-world.css">
</head>
<body>
<script src="assets/vendor.js"></script>
<script src="assets/hello-world.js"></script>
</body>
</html>
In older Ember-Versions we wrote our templates inside this index.html. I know ember "precompiles" the templates now, but where are they? When I open the index.html with a Browser I get an empty page. How does this work now? Do we need to run a node server for the ember-app? I just want to copy the output of ember build
inside a Asp.Net project and include the files into my index.cshtml.
Upvotes: 0
Views: 474
Reputation: 18672
In older Ember-Versions we wrote our templates inside this index.html. I know ember "precompiles" the templates now, but where are they?
index.html
is located in app/index.html
. Rest of templates is in app/templates/
.
When I open the index.html with a Browser I get an empty page. How does this work now?
You should get errors in your console:
file:///assets/vendor.css Failed to load resource: net::ERR_FILE_NOT_FOUND
file:///assets/appName.css Failed to load resource: net::ERR_FILE_NOT_FOUND
file:///assets/vendor.js Failed to load resource: net::ERR_FILE_NOT_FOUND
file:///assets/appName.js Failed to load resource: net::ERR_FILE_NOT_FOUND
It's because you don't have any server which would serve this assets. Opening dist/index.html
directly via browser will not succeed. You need to setup simple Python server or copy assets to correct directories in your ASP.NET application. It should correctly expose assets paths for your Ember application.
I just want to copy the output of ember build inside a Asp.Net project and include the files into my index.cshtml.
Do it. Place assets in correct folders, copy index.html
contents to your .cshtml
file.
However, I guess your approach won't work. If you want to integrate ASP.NET application with Ember, mixing files etc. you should include Ember library by yourself in ASP.NET files, then write code using globals(App.IndexController
etc.).
Upvotes: 0