javascript - 使用模板编译器处理文件时(针对目标 web.browser)

标签 javascript html css meteor

作为初学者,我在 meteor 中运行了 simple-todos 应用程序,它运行良好,现在我在 ma​​in.html 中做了一些小修改,如下所示

<head>
  <title>mywebapp</title>
</head>
<style>
  body
  {
    background-image: url("mainimage.jpg");
  }
</style>
<body>
  <h1>Development in progress</h1>
</body>

但是当我刷新页面时,我看到下面的错误

Errors prevented startup:

While processing files with templating-compiler (for target web.browser): client/main.html:1: Expected one of: <body>, <head>, <template>

Your application has errors. Waiting for file change.

我对这个错误没有任何线索。谁能告诉我这是什么问题?

主.css

/* CSS declarations go here */
<style>
  body
  {
    background-image: url("mainimage.jpg");
  }
</style>

最佳答案

在 css 文件中定义样式,而不是 <style>阻止你的html。您甚至不需要导入 css 文件,Meteor 会自动包含它。

关于javascript - 使用模板编译器处理文件时(针对目标 web.browser),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47036400/

相关文章:

javascript - 我如何在响应式 HTML5 图像中使用 srcset 和大小来获取占其容器百分比的图像?

javascript - 为什么倒计时数字经过一定时间后颜色没有变化?

javascript - 如何使用 Ajax 将文档上传到 Web api,而不使用 html 用户控件或表单?

javascript - 页面不在 Wordpress 中加载样式表或 JS 文件

css - Github Pages 上的 Jekyll 不一致地应用 css 样式

html - 如何去除边框?

javascript - 如何使用 Javascript 打开另一个 HTML 页面

javascript - d3.js: parent 的大小= child 的大小之和

javascript - 单击时 Facebook 使用什么来加载新的标签?

php - 图像已上传到文件夹中时如何解决 Laravel 中的 "file does not exist or is not readable"