All Versions
DSpace Documentation
...
src/themes/dspace): This is a simple, example theme for novice users. Primarily, in this theme, you can immediately customize the CSS, header & homepage components. You can add other components as needed (see "Adding Component Directories to your Theme" below).src/themes/custom): This theme provides all available theme-able components for more advanced or complex theming options. This provides you full control over everything that is theme-able in the User Interfacesrc/themes/ (choose whatever folder name you want)Modify angular.json (in the root folder), adding your theme folder's main "theme.scss" file to the "styles" list. The below example is for a new theme folder named src/themes/mydspacesite/
| Code Block |
|---|
"styles": [
"src/styles/startup.scss",
{
"input": "src/styles/base-theme.scss",
"inject": false,
"bundleName": "base-theme"
},
...
{
"input": "src/themes/mydspacesite/styles/theme.scss",
"inject": false,
"bundleName": "mydspacesite-theme"
},
] |
NOTE: the "bundleName" for your custom them MUST use the format "${folder-name}-theme". E.g. if the folder is named "src/themes/amazingtheme", then the "bundleName" MUST be "amazingtheme-theme"
eager-theme.module.ts in themes/eager-themes.module.ts
| Code Block | ||
|---|---|---|
| ||
// COMMENT out the imports for any themes you are NOT using
//import { EagerThemeModule as DSpaceEagerThemeModule } from './dspace/eager-theme.module';
//import { EagerThemeModule as CustomEagerThemeModule } from './custom/eager-theme.module';
// Add a new import for your custom theme. Give its EagerThemeModule a unique name (e.g. "as [choose-a-unique-name]").
// Make sure the path points at its "eager-theme.module.ts" (see 'from' portion of the import statement).
// NOTE: You can import multiple themes if you plan to use multiple themes
import { EagerThemeModule as MyThemeEagerThemeModule } from './my-theme/eager-theme.module';
...
@NgModule({
imports: [
// Again, comment out any themes you are NOT using
//DSpaceEagerThemeModule,
//CustomEagerThemeModule,
// Add your custom theme's EagerThemeModule to this list
// NOTE: you can add multiple theme's to this list if you plan to use multiple themes.
MyThemeEagerThemeModule,
],
}) |
Enable your theme: Modify your config/config.*.yml configuration file, adding your new theme to the "themes" array in that file. Pay close attention to modify the correct configuration file (e.g. modify config.dev.yml if running in dev mode, or config.prod.yml if running in prod mode). We recommend starting in "dev mode" (config.dev.yml) as this mode lets you see your changes immediately in a browser without a full rebuild of the UI – see next step.
| Code Block | ||||
|---|---|---|---|---|
| ||||
# In this example, we only show one theme enabled. It's possible to enable multiple (see below note) themes: - name: 'mydspacesite' | ||||
| Code Block | ||||
| title | Format for 7.1 or 7.0 (environment.*.ts)||||
// In this example, we only show one theme enabled. It's possible to enable multiple (see below note)
themes: [
{
name: 'mydspacesite'
},
] |
src/themes/mydspacesite/ globally. You should also comment out the default "dspace" theme, if you intend to replace it entirely.Verify your settings by starting the UI (ideally in Dev mode): At this point, you should verify the basic settings you've made all "work". We recommend doing your theme work while running the UI in "dev mode", as the UI will auto-restart anytime you save a new change. This will allow you to quickly see the impact of each change in your browser.
| Code Block |
|---|
# Start in dev mode (which uses config.dev.yml) npm run start:dev |
...