简体   繁体   English

<%= %> HTML 标签的含义是什么?

[英]What is the meaning of the <%= %> HTML tag?

I have been working on a Webpack project.我一直在做一个 Webpack 项目。 For anyone unfamiliar with Webpack, it is a bundler that takes all your files and spits out a final product.对于不熟悉 Webpack 的人来说,它是一个打包器,可以获取您的所有文件并输出最终产品。

I wanted to inject one HTML file into another, like an import or require().我想将一个 HTML 文件注入到另一个文件中,例如 import 或 require()。 I have been using this GitHub template to help me piece together my project.我一直在使用这个 GitHub 模板来帮助我拼凑我的项目。 https://github.com/dharmikumbhani/webpack-multipage-starter https://github.com/dharmikumbhani/webpack-multipage-starter

In webpack-multipage-starter/src/page-index/index.html on line 10 and 11 there is the following:在第 10 和 11 行的 webpack-multipage-starter/src/page-index/index.html 中有以下内容:

<!-- intercepted by a resourceQuery in the webpack config -->
<%= require('../partials/nav.html?raw') %>

This line gets intercepted by a resourceQuery (in the webpack.common.js configuration) and the HTML file is injected into this position.此行被 resourceQuery(在 webpack.common.js 配置中)拦截,并将 HTML 文件注入此位置。

What is the meaning of this HTML tag?这个 HTML 标签是什么意思?

<%= => <%= =>

All I know is that it holds a Java-Script expression which gets evaluated during the Webpack build process.我所知道的是它包含一个在 Webpack 构建过程中被评估的 Java-Script 表达式。

It is an EJS template .它是一个EJS 模板 It is used by html-webpack-plugin to generate html pages typically for bootstrapping your Multipage apps or SPA apps. html-webpack-plugin使用它来生成 html 页面,通常用于引导您的多页应用程序或 SPA 应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM