mirror of https://github.com/ghostfolio/ghostfolio
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.8 KiB
41 lines
1.8 KiB
"use strict";
|
|
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.dev/license
|
|
*/
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.addFontsToIndex = addFontsToIndex;
|
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
const schematics_2 = require("@angular/cdk/schematics");
|
|
const utility_1 = require("@schematics/angular/utility");
|
|
/** Adds the Material Design fonts to the index HTML file. */
|
|
function addFontsToIndex(options) {
|
|
return async (host) => {
|
|
const workspace = await (0, utility_1.readWorkspace)(host);
|
|
const project = (0, schematics_2.getProjectFromWorkspace)(workspace, options.project);
|
|
const projectIndexFiles = (0, schematics_2.getProjectIndexFiles)(project);
|
|
if (!projectIndexFiles.length) {
|
|
throw new schematics_1.SchematicsException('No project index HTML file could be found.');
|
|
}
|
|
const preconnectLinks = [
|
|
'<link rel="preconnect" href="https://fonts.googleapis.com">',
|
|
'<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>',
|
|
];
|
|
const fonts = [
|
|
'https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap',
|
|
'https://fonts.googleapis.com/icon?family=Material+Icons',
|
|
];
|
|
projectIndexFiles.forEach(indexFilePath => {
|
|
preconnectLinks.forEach(link => {
|
|
(0, schematics_2.appendHtmlElementToHead)(host, indexFilePath, link);
|
|
});
|
|
fonts.forEach(font => {
|
|
(0, schematics_2.appendHtmlElementToHead)(host, indexFilePath, `<link href="${font}" rel="stylesheet">`);
|
|
});
|
|
});
|
|
};
|
|
}
|
|
//# sourceMappingURL=material-fonts.js.map
|