本文整理汇总了TypeScript中@angular/cdk/schematics.getProjectTargetOptions函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getProjectTargetOptions函数的具体用法?TypeScript getProjectTargetOptions怎么用?TypeScript getProjectTargetOptions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getProjectTargetOptions函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should register inline theme if no theme already registered', () => {
const tree = runSetupSchematic({ customization: false });
const workspace = getWorkspace(tree);
const project = getProjectFromWorkspace(workspace);
const styles = getProjectTargetOptions(project, 'build').styles;
expect(styles).toContain('./node_modules/@nebular/theme/styles/prebuilt/default.css')
});
开发者ID:kevinheader,项目名称:nebular,代码行数:8,代码来源:index.spec.ts
示例2: getIndexHtmlPath
export function getIndexHtmlPath(project: WorkspaceProject): string {
const buildOptions = getProjectTargetOptions(project, 'build');
if (!buildOptions.index) {
throw new SchematicsException('No project "index.html" file could be found.');
}
return buildOptions.index;
}
开发者ID:codef0rmer,项目名称:material2,代码行数:9,代码来源:project-index-html.ts
示例3: it
it('should not add a theme file multiple times', async () => {
writeStyleFileToWorkspace(appTree, defaultPrebuiltThemePath);
const tree = await runner.runSchematicAsync('ng-add-setup-project', {}, appTree).toPromise();
const workspace = getWorkspace(tree);
const project = getProjectFromWorkspace(workspace);
const styles = getProjectTargetOptions(project, 'build').styles;
expect(styles).toEqual(['projects/material/src/styles.css', defaultPrebuiltThemePath],
'Expected the "styles.css" file and default prebuilt theme to be the only styles');
});
开发者ID:codef0rmer,项目名称:material2,代码行数:11,代码来源:index.spec.ts
示例4: addStyleToTarget
/**
* Adds a style entry to the given project target.
* */
function addStyleToTarget(project: WorkspaceProject, targetName: string, tree: Tree,
stylesPath: string, workspace: WorkspaceSchema) {
const targetOptions = getProjectTargetOptions(project, targetName);
if (!targetOptions.styles) {
targetOptions.styles = [stylesPath];
} else if (noNebularThemeIncluded(targetOptions, stylesPath)) {
targetOptions.styles.unshift(stylesPath);
}
writeJSON(tree, 'angular.json', workspace);
}
开发者ID:kevinheader,项目名称:nebular,代码行数:15,代码来源:index.ts
示例5: writeStyleFileToWorkspace
/** Writes a specific style file to the workspace in the given tree */
function writeStyleFileToWorkspace(tree: Tree, stylePath: string) {
const workspace = getWorkspace(tree);
const project = getProjectFromWorkspace(workspace);
const buildOptions = getProjectTargetOptions(project, 'build');
if (!buildOptions.styles) {
buildOptions.styles = [stylePath];
} else {
buildOptions.styles.push(stylePath);
}
tree.overwrite('/angular.json', JSON.stringify(workspace, null, 2));
}
开发者ID:codef0rmer,项目名称:material2,代码行数:14,代码来源:index.spec.ts
示例6: addThemeStyleToTarget
/** Adds a theming style entry to the given project target options. */
function addThemeStyleToTarget(project: WorkspaceProject, targetName: 'test' | 'build', host: Tree,
assetPath: string, workspace: WorkspaceSchema): void {
// Do not update the builder options in case the target does not use the default CLI builder.
if (!validateDefaultTargetBuilder(project, targetName)) {
return;
}
const targetOptions = getProjectTargetOptions(project, targetName);
if (!targetOptions.styles) {
targetOptions.styles = [ assetPath ];
} else {
const existingStyles = targetOptions.styles.map(s => typeof s === 'string' ? s : s.input);
for (const [ index, stylePath ] of existingStyles.entries()) {
// If the given asset is already specified in the styles, we don't need to do anything.
if (stylePath === assetPath) {
return;
}
// In case a prebuilt theme is already set up, we can safely replace the theme with the new
// theme file. If a custom theme is set up, we are not able to safely replace the custom
// theme because these files can contain custom styles, while prebuilt themes are
// always packaged and considered replaceable.
if (stylePath.includes(defaultCustomThemeFilename)) {
console.log();
console.warn(chalk.yellow(`Could not style file to the CLI project configuration ` +
`because there is already a custom theme file referenced.`));
console.warn(chalk.yellow(`Please manually add the following style file to your configuration:`));
console.warn(chalk.cyan(`${chalk.bold(assetPath)}`));
return;
} else if (stylePath.includes(compiledThemePathSegment)) {
targetOptions.styles.splice(index, 1);
}
}
targetOptions.styles.unshift(assetPath);
}
host.overwrite('angular.json', JSON.stringify(workspace, null, 2));
}
开发者ID:SrgGs,项目名称:ng-zorro-antd,代码行数:42,代码来源:theming.ts
示例7: return
return (host: Tree) => {
const workspace = getWorkspace(host);
const project = getProjectFromWorkspace(workspace, options.project);
const targetOptions = getProjectTargetOptions(project, 'build');
if (!targetOptions.assets) {
targetOptions.assets = [ { ...iconAssetObject } ];
} else {
const assets = targetOptions.assets as Array<string | object>;
const assetsString = JSON.stringify(assets);
if (!assetsString.includes(iconPathSegment)) {
assets.push({ ...iconAssetObject });
} else {
console.log();
console.log(chalk.yellow(`Could not add the icon assets to the CLI project assets ` +
`because there is already a icon assets file referenced.`));
console.log(chalk.yellow(`Please manually add the following config to your assets:`));
console.log(chalk.cyan(JSON.stringify(iconAssetObject, null, 2)));
return host;
}
}
host.overwrite('angular.json', JSON.stringify(workspace, null, 2));
return host;
};
开发者ID:SrgGs,项目名称:ng-zorro-antd,代码行数:24,代码来源:add-icon-assets.ts
示例8: expectProjectStyleFile
/** Expects the given file to be in the styles of the specified workspace project. */
function expectProjectStyleFile(project: WorkspaceProject, filePath: string) {
expect(getProjectTargetOptions(project, 'build').styles).toContain(filePath,
`Expected "${filePath}" to be added to the project styles in the workspace.`);
}
开发者ID:codef0rmer,项目名称:material2,代码行数:5,代码来源:index.spec.ts
注:本文中的@angular/cdk/schematics.getProjectTargetOptions函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论