Gentics UI Core
This is the common core framework for the Gentics CMS and Mesh UI, and other Angular applications.
Using ui-core in a project
- Install via npm:
npm install gentics-ui-core --save
- Import the module and add it to your app's root module:
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { GenticsUICoreModule } from 'gentics-ui-core';
@NgModule({
imports: [
FormsModule,
GenticsUICoreModule.forRoot(),
ReactiveFormsModule
]
}
export class AppModule { }
- Add the
<gtx-overlay-host>
component to your AppComponent's template if you want to use components that have overlay parts:
<gtx-overlay-host></gtx-overlay-host>
- If you are using RxJS 6.x, install rxjs-compat:
npm install rxjs-compat --save
View Encapsulation
Do not use any ViewEncapsulation other than ViewEncapsulation.None
(which is the default), because some UI Core components use the CSS /deep/
selector.
Lazy Loading of Routes
If you are using lazy loading of routes, the singleton services need to be provided again in the lazily loaded module, because otherwise they will not be found. For example:
@NgModule({
providers: [
ModalService,
OverlayHostService
]
})
export class MyLazilyLoadedModule {
}
Using ui-core in an angular-cli project
- Create a new app using angular-cli (this guide assumes angular-cli version 6.x). The following command will create a new app with the name
my-example
in the folder ./my-example
, use me
as the prefix for components, set up a routing module, and use SCSS for defining styles. Please note that while a custom prefix and the routing module are optional, SCSS must be used for the styles in order to be compatible with Gentics UI Core.
ng new my-example --prefix me --routing --style scss
- Uncomment (and if necessary, install) the polyfills required for your target browsers in
polyfills.ts
and add the following assignment in that file:
(window as any).global = window;
-
Follow the steps from Using ui-core in a project.
-
Add the following imports to your global styles SCSS:
$icons-font-path: '~gentics-ui-core/dist/fonts/';
$roboto-font-path: '~gentics-ui-core/dist/fonts/';
@import "~gentics-ui-core/dist/styles/variables";
@import "~gentics-ui-core/dist/styles/mixins";
@import "~gentics-ui-core/dist/styles/core";
You can see the _variables.scss file for a list of variables, which you can override before importing the variables file.
Documentation
Full documentation and examples are available at https://gentics.github.io/gentics-ui-core/
Building the docs app
Although the UI Core is intended to be consumed in a raw (uncompiled) state, there is a demo app
included under src/demo
which will serve as a "living style guide"
as well as a way to manually test each of the core components.
npm install
gulp docs:build
- Serve the contents of the
docs/
folder
Releasing
- Bump the version in
package.json
to the desired value git commit -am 'v6.X.Y'
git tag v6.X.Y
git reset --hard HEAD^
git push origin v6.X.Y maintenance-v6.x
Publish to npm
gulp dist:build
npm publish
Maintaining documentation on GitHub pages
Documentation is built as a static Angular app into "docs" and maintained on the branch "gh-pages".
The easiest way to manage the branch is to check it out in the "docs" subfolder:
git clone -o github -b gh-pages git@github.com:gentics/gentics-ui-core ./docs
gulp docs:build --docsVersion=v6.x
cd docs
git add .
git commit -m "Update v6.x docs to v6.Y.Z"
git push github