Angular2-Template-Loader: 用于 Webpack 的 HTML 和样式内联加载器

Angular2-template-loader 是一个用于 webpack 的链式加载器,它可以将 HTML 和样式直接插入到 Angular 组件中。

安装

使用 npm 安装 angular2-template-loader:

npm install angular2-template-loader --save-dev

在 webpack 配置文件中,将 angular2-template-loader 添加到 TypeScript 加载器链中:

loaders: [
  'awesome-typescript-loader',
  'angular2-template-loader'
],

要求

要使用 angular2-template-loader,需要在 webpack 中注册一个能够处理 .html.css 文件的加载器,例如 raw-loader

优势

  • 将模板与组件文件分离,提高代码可维护性。
  • 支持 Ahead-of-Time (AoT) 编译,提升应用程序性能。
  • 对于包含大型模板的复杂组件特别有用。
zip
angular2-template-loader-master.zip 预估大小:18个文件
folder
angular2-template-loader-master 文件夹
file
.travis.yml 218B
file
index.js 2KB
file
package.json 1KB
folder
test 文件夹
file
loader.spec.js 4KB
folder
fixtures 文件夹
file
index.js 1KB
file
component_without_relative_period_slash.js 290B
file
sample_angular_component_file_string_simple.js 329B
file
component_with_template_url_ending_by_space.js 321B
file
component_with_single_line_decorator.js 273B
file
component_with_quote_in_urls.js 271B
file
component_with_multiple_styles.js 300B
file
component_with_spacing.js 288B
file
LICENSE 1KB
file
.npmignore 133B
file
.gitignore 485B
file
README.md 4KB
file
.editorconfig 258B
folder
.vscode 文件夹
file
settings.json 40B
zip 文件大小:10.86KB