material-fonts.js 1.2 KB

123456789101112131415161718192021222324252627282930
  1. "use strict";
  2. /**
  3. * @license
  4. * Copyright Google LLC All Rights Reserved.
  5. *
  6. * Use of this source code is governed by an MIT-style license that can be
  7. * found in the LICENSE file at https://angular.io/license
  8. */
  9. Object.defineProperty(exports, "__esModule", { value: true });
  10. const schematics_1 = require("@angular/cdk/schematics");
  11. const config_1 = require("@schematics/angular/utility/config");
  12. const project_index_html_1 = require("./project-index-html");
  13. /** Adds the Material Design fonts to the index HTML file. */
  14. function addFontsToIndex(options) {
  15. return (host) => {
  16. const workspace = config_1.getWorkspace(host);
  17. const project = schematics_1.getProjectFromWorkspace(workspace, options.project);
  18. const projectIndexHtmlPath = project_index_html_1.getIndexHtmlPath(project);
  19. const fonts = [
  20. 'https://fonts.googleapis.com/css?family=Roboto:300,400,500&display=swap',
  21. 'https://fonts.googleapis.com/icon?family=Material+Icons',
  22. ];
  23. fonts.forEach(f => {
  24. schematics_1.appendHtmlElementToHead(host, projectIndexHtmlPath, `<link href="${f}" rel="stylesheet">`);
  25. });
  26. return host;
  27. };
  28. }
  29. exports.addFontsToIndex = addFontsToIndex;
  30. //# sourceMappingURL=material-fonts.js.map