"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const schematics_1 = require("@angular-devkit/schematics");
const schematics_2 = require("@angular/cdk/schematics");
const config_1 = require("@schematics/angular/utility/config");
const project_index_file_1 = require("../utils/project-index-file");
/** Adds the Roboto & Material Icons fonts to the index HTML file. */
function addFontsToIndex(options) {
    return (host) => {
        const workspace = config_1.getWorkspace(host);
        const project = schematics_2.getProjectFromWorkspace(workspace, options.project);
        const projectIndexFiles = project_index_file_1.getProjectIndexFiles(project);
        if (!projectIndexFiles.length) {
            throw new schematics_1.SchematicsException('No project index HTML file could be found.');
        }
        [
            'https://fonts.googleapis.com/css?family=Roboto:300,400,500|Material+Icons'
        ].forEach(font => projectIndexFiles.forEach((indexFilePath) => schematics_2.appendHtmlElementToHead(host, indexFilePath, `<link href="${font}" rel="stylesheet">`)));
        return host;
    };
}
exports.addFontsToIndex = addFontsToIndex;
//# sourceMappingURL=fonts.js.map