@aboudard/bootstrap-schematics 中文文档教程

发布于 5年前 浏览 21 项目主页 更新于 3年前

Angular Schematics for Bootstrap

使用 @ng-bootstrap/ng-bootstrap 和基本 scss 覆盖将 Bootstrap 添加到 Angular 项目的工具列表。 它确实写入了 angular.json 配置文件,并且可以删除默认的 styles.css 文件。 也可以运行 Font Awesome 安装。

Dependencies

您需要全局安装 Typescript 和 tslint

npm install tslint typescript -g

Using Shematics

  • Create a new project with Angular CLI
  • Simply add the package
ng add @aboudard/bootstrap-schematics
  • Eventually remove the current package

List of options

  • removeStyles : When true, removes the default syles.css in root folder
  • replaceAppTemplate : When true, replaces the app.component and adds other classic bootstrap components
  • installFontAwesome : When true, installs font awesome and minimal config

Option Font Awesome

  • If you choose this option, just call, where needed, the service method under /shared/services/utils.service. It does use free-solid icon package by default, and adds faCheck icon via the library.
import {FaIconLibrary} from '@fortawesome/angular-fontawesome';
import {
  faCheck
} from '@fortawesome/free-solid-svg-icons';

@Injectable({
  providedIn: 'root'
})
export class UtilsService {
  constructor(private faIconLibrary: FaIconLibrary) { }
  initFaIcons(): void {
    this.faIconLibrary.addIcons(
      faCheck
    );
  }
}

Testing

要在本地进行测试,请全局安装 @angular-devkit/schematics-cli 并使用 schematics 命令行工具。 该工具的作用与 Angular CLI 的 generate 命令相同,但还具有调试模式。

通过在本地运行这些任务查看文档

schematics --help

以查看沙盒应用程序中原理图的结果:

npm run build
npm run link:schematic
npm run test

或者在没有应用程序测试的情况下运行:

npm run buildschematics

Unit Testing

npm run test 将运行单元测试,使用 Jasmine 作为运行器和测试框架。

Publishing

要发布,只需执行以下操作:

npm run build
npm publish

就是这样!

Angular Schematics for Bootstrap

List of tools to add Bootstrap to an Angular project with @ng-bootstrap/ng-bootstrap and basic scss override. It does write in angular.json config file and can remove the default styles.css file. Can also run Font Awesome install.

Dependencies

You need global install of Typescript and tslint

npm install tslint typescript -g

Using Shematics

  • Create a new project with Angular CLI
  • Simply add the package
ng add @aboudard/bootstrap-schematics
  • Eventually remove the current package

List of options

  • removeStyles : When true, removes the default syles.css in root folder
  • replaceAppTemplate : When true, replaces the app.component and adds other classic bootstrap components
  • installFontAwesome : When true, installs font awesome and minimal config

Option Font Awesome

  • If you choose this option, just call, where needed, the service method under /shared/services/utils.service. It does use free-solid icon package by default, and adds faCheck icon via the library.
import {FaIconLibrary} from '@fortawesome/angular-fontawesome';
import {
  faCheck
} from '@fortawesome/free-solid-svg-icons';

@Injectable({
  providedIn: 'root'
})
export class UtilsService {
  constructor(private faIconLibrary: FaIconLibrary) { }
  initFaIcons(): void {
    this.faIconLibrary.addIcons(
      faCheck
    );
  }
}

Testing

To test locally, install @angular-devkit/schematics-cli globally and use the schematics command line tool. That tool acts the same as the generate command of the Angular CLI, but also has a debug mode.

Check the documentation with

schematics --help

Run these tasks locally to see the results of schematics in the sandbox app :

npm run build
npm run link:schematic
npm run test

Or run without app tests :

npm run buildschematics

Unit Testing

npm run test will run the unit tests, using Jasmine as a runner and test framework.

Publishing

To publish, simply do:

npm run build
npm publish

That's it!

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文