@nx/angular:library
Creates an Angular library.
Creates an Angular library.
Creates the my-ui-lib library with an ui tag:
1nx g @nx/angular:library libs/my-ui-lib --tags=ui
21nx generate library ...
21nx g lib ... #same
2By default, Nx will search for library in the default collection provisioned in workspace.json.
You can specify the collection explicitly as follows:
1nx g @nx/angular:library ...
2Show what will be generated without writing to disk:
1nx g library ... --dry-run
2A directory where the library is placed.
falseGenerate a buildable library.
falseAdd RouterModule.forChild when set to true, and a simple array of routes when set to false.
The name of the library.
falseGenerate a publishable library.
Path to the parent route configuration using loadChildren or children, depending on what lazy is set to.
falseAdd router configuration. See lazy for more information.
falseAdd a module spec file.
falseWhether to configure Tailwind CSS for the application. It can only be used with buildable and publishable libraries. Non-buildable libraries will use the application's Tailwind configuration.
full, partialSpecifies the compilation mode to use. If not specified, it will default to partial for publishable libraries and to full for buildable libraries. The full value can not be used for publishable libraries.
DefaultDefault, OnPushThe change detection strategy to use in the new component. Disclaimer: This option is only valid when --standalone is set to true.
falseSpecifies if the component generated style will contain :host { display: block; }. Disclaimer: This option is only valid when --standalone is set to true.
falseEnsure the generated standalone component is not placed in a subdirectory. Disclaimer: This option is only valid when --standalone is set to true.
The library name used to import it, like @myorg/my-awesome-lib. Must be a valid npm name.
falseInclude styles inline in the component.ts file. Only CSS styles can be included inline. By default, an external styles file is created and referenced in the component.ts file. Disclaimer: This option is only valid when --standalone is set to true.
falseInclude template inline in the component.ts file. By default, an external template file is created and referenced in the component.ts file. Disclaimer: This option is only valid when --standalone is set to true.
eslinteslint, noneThe tool to use for running lint checks.
html-selectorThe prefix to apply to generated selectors.
falseDon't include the directory in the name of the module or standalone component entry of the library.
falseDo not update tsconfig.json for development experience.
trueCreate a library with stricter type checking and build optimization options.
falseWhether or not to configure the ESLint parserOptions.project option. We do not do this by default for lint performance reasons.
falseWhether to skip the creation of a default module when generating the library.
trueGenerate a library that uses a standalone component instead of a module as the entry point.
csscss, scss, sass, less, noneThe file extension or preprocessor to use for style files, or none to skip generating the style file. Disclaimer: This option is only valid when --standalone is set to true.
falseDo not create spec.ts test files for the new component. Disclaimer: This option is only valid when --standalone is set to true.
html-selectorThe HTML selector to use for this component. Disclaimer: This option is only valid when --standalone is set to true.
falseSpecifies if the component should have a selector or not. Disclaimer: This option is only valid when --standalone is set to true.
Add tags to the library (used for linting).
jestjest, noneTest runner to use for unit tests.
Emulated, None, ShadowDomThe view encapsulation strategy to use in the new component. Disclaimer: This option is only valid when --standalone is set to true.
falseSkip formatting files.
falseDo not add dependencies to package.json.
trueSplit the project configuration into <projectRoot>/project.json rather than including it inside workspace.json.
Nx only supports standaloneConfig
Watch the replays of exciting talks on developer tooling and monorepos! Catch all the insightful presentations from the event on our YouTube channel.