source: trip-planner-front/node_modules/@angular/material/schematics/ng-add/fonts/material-fonts.mjs@ ceaed42

Last change on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 5.7 KB
Line 
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 */
9var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
10 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
11 return new (P || (P = Promise))(function (resolve, reject) {
12 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
13 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
14 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
15 step((generator = generator.apply(thisArg, _arguments || [])).next());
16 });
17};
18Object.defineProperty(exports, "__esModule", { value: true });
19exports.addFontsToIndex = void 0;
20const schematics_1 = require("@angular-devkit/schematics");
21const schematics_2 = require("@angular/cdk/schematics");
22const workspace_1 = require("@schematics/angular/utility/workspace");
23/** Adds the Material Design fonts to the index HTML file. */
24function addFontsToIndex(options) {
25 return (host) => __awaiter(this, void 0, void 0, function* () {
26 const workspace = yield workspace_1.getWorkspace(host);
27 const project = schematics_2.getProjectFromWorkspace(workspace, options.project);
28 const projectIndexFiles = schematics_2.getProjectIndexFiles(project);
29 if (!projectIndexFiles.length) {
30 throw new schematics_1.SchematicsException('No project index HTML file could be found.');
31 }
32 const preconnect = `<link rel="preconnect" href="https://fonts.gstatic.com">`;
33 const fonts = [
34 'https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap',
35 'https://fonts.googleapis.com/icon?family=Material+Icons',
36 ];
37 projectIndexFiles.forEach(indexFilePath => {
38 schematics_2.appendHtmlElementToHead(host, indexFilePath, preconnect);
39 fonts.forEach(font => {
40 schematics_2.appendHtmlElementToHead(host, indexFilePath, `<link href="${font}" rel="stylesheet">`);
41 });
42 });
43 });
44}
45exports.addFontsToIndex = addFontsToIndex;
46//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWF0ZXJpYWwtZm9udHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvbWF0ZXJpYWwvc2NoZW1hdGljcy9uZy1hZGQvZm9udHMvbWF0ZXJpYWwtZm9udHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7R0FNRzs7Ozs7Ozs7Ozs7O0FBRUgsMkRBQTJFO0FBQzNFLHdEQUlpQztBQUNqQyxxRUFBbUU7QUFHbkUsNkRBQTZEO0FBQzdELFNBQWdCLGVBQWUsQ0FBQyxPQUFlO0lBQzdDLE9BQU8sQ0FBTyxJQUFVLEVBQUUsRUFBRTtRQUMxQixNQUFNLFNBQVMsR0FBRyxNQUFNLHdCQUFZLENBQUMsSUFBSSxDQUFDLENBQUM7UUFDM0MsTUFBTSxPQUFPLEdBQUcsb0NBQXVCLENBQUMsU0FBUyxFQUFFLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FBQztRQUNwRSxNQUFNLGlCQUFpQixHQUFHLGlDQUFvQixDQUFDLE9BQU8sQ0FBQyxDQUFDO1FBRXhELElBQUksQ0FBQyxpQkFBaUIsQ0FBQyxNQUFNLEVBQUU7WUFDN0IsTUFBTSxJQUFJLGdDQUFtQixDQUFDLDRDQUE0QyxDQUFDLENBQUM7U0FDN0U7UUFFRCxNQUFNLFVBQVUsR0FBRywwREFBMEQsQ0FBQztRQUM5RSxNQUFNLEtBQUssR0FBRztZQUNaLCtFQUErRTtZQUMvRSx5REFBeUQ7U0FDMUQsQ0FBQztRQUVGLGlCQUFpQixDQUFDLE9BQU8sQ0FBQyxhQUFhLENBQUMsRUFBRTtZQUN4QyxvQ0FBdUIsQ0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sIHByZWNvbm5lY3QpO1xuXG4gICAgICBmb250cy5mb3JFYWNoKGZvbnQgPT4ge1xuICAgICAgICBhcHBlbmRIdG1sRWxlbWVudFRvSGVhZChob3N0LCBpbmRleEZpbGVQYXRoLCBgPGxpbmsgaHJlZj1cIiR7Zm9udH1cIiByZWw9XCJzdHlsZXNoZWV0XCI+YCk7XG4gICAgICB9KTtcbiAgICB9KTtcbiAgfTtcbn1cbiJdfQ==
Note: See TracBrowser for help on using the repository browser.