# 集成
¥Integrations
以下软件包在不同环境中集成了 Handlebars。这些软件包并未得到 Handlebars 团队的正式支持。
¥The following packages integrate Handlebars in different environments. These packages are not officially supported by the Handlebars team.
有多个 webpack 插件允许你在 Webpack 环境中使用 Handlebars。
¥There are multiple webpack-plugins that allow you to use Handlebars in a Webpack environment.
# Webpack:handlebars-loader
handlebars-loader (opens new window) 允许你导入 precompiled 模板。只需将你的 Handlebars 模板写入 template.handlebars
文件并使用导入即可
¥The handlebars-loader (opens new window) allow you to import
precompiled template. Just write your handlebars-template into a template.handlebars
-file and
import it using
const compiledTemplate = require("./template.handlebars");
or
import compiledTemplate from "./template.handlebars";
# Webpack:handlebars-webpack-plugin
编译应用时,handlebars-webpack-plugin (opens new window) 使用 Handlebars 静态构建 HTML 页面
¥The handlebars-webpack-plugin (opens new window) uses Handlebars to build your HTML-pages statically when compiling your application
# Webpack:html-bundler-webpack-plugin
html-bundler-webpack-plugin (opens new window) 使用各种模板引擎 引入 Handlebars (opens new window) 来渲染模板并将样式和脚本打包到生成的 HTML 中。
¥The html-bundler-webpack-plugin (opens new window) uses various templating engines, including Handlebars (opens new window), to render templates and bundle styles and scripts into generated HTML.
# Babel:handlebars-inline-precompile
babel-plugin-handlebars-inline-precompile (opens new window) 预编译 Handlebars 模板,这些模板在 JavaScript 源代码中作为模板字面量提供:
¥The babel-plugin-handlebars-inline-precompile (opens new window) precompiles Handlebars templates that are provided as template literals in the JavaScript source code:
import hbs from "handlebars-inline-precompile";
const compiledTemplate = hbs`{{name}}`;
请参阅软件包的文档以获取安装说明。
¥Please refer to the documentation of the package for setup instructions.
# Browserify:hbsfy
hbsfy (opens new window) 包允许你在 browserify 环境中导入预编译模板:
¥The hbsfy (opens new window) package allows you to import precompiled templates in a browserify environment:
const compiledTemplate = require("./template.handlebars");
# Parcel:parcel-plugin-handlebars
Parcel 有一个旧插件:https://www.npmjs.com/package/parcel-plugin-handlebars (opens new window)
¥There is an old plugin for parcel: https://www.npmjs.com/package/parcel-plugin-handlebars (opens new window)
但是你应该使用该软件包的众多分支之一,它们是最新的:https://www.npmjs.com/search?q=parcel-plugin-handlebars (opens new window)
¥But you should use one of the many forks of this package, which are more up-to-date: https://www.npmjs.com/search?q=parcel-plugin-handlebars (opens new window)
最近的一项是:https://www.npmjs.com/package/@inventory/parcel-plugin-handlebars (opens new window)
¥The most recent one is: https://www.npmjs.com/package/@inventory/parcel-plugin-handlebars (opens new window)
# Parcel:parcel-plugin-handlebars-precompile
待办事项:在这里写下文本
¥TODO: Write text here
https://www.npmjs.com/package/parcel-plugin-handlebars-precompile (opens new window)