简体   繁体   中英

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

I have been working on a Webpack project. For anyone unfamiliar with Webpack, it is a bundler that takes all your files and spits out a final product.

I wanted to inject one HTML file into another, like an import or require(). I have been using this GitHub template to help me piece together my project. 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:

<!-- 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.

What is the meaning of this HTML tag?

<%= =>

All I know is that it holds a Java-Script expression which gets evaluated during the Webpack build process.

It is an EJS template . It is used by html-webpack-plugin to generate html pages typically for bootstrapping your Multipage apps or SPA apps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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