2019-10-09 12:32:58 +02:00
# Customization
2019-05-06 16:17:16 +02:00
2020-03-22 13:28:03 -04:00
The administration panel can be customized according to your needs, so you can make it reflect your identity.
2019-05-06 16:17:16 +02:00
2019-09-24 17:44:50 +02:00
::: warning
To apply your changes you need to [rebuild ](#build ) your admin panel
:::
2019-10-09 12:32:58 +02:00
## Change access URL
2019-05-06 16:17:16 +02:00
By default, the administration panel is exposed via [http://localhost:1337/admin ](http://localhost:1337/admin ). However, for security reasons, you can easily update this path.
2020-04-10 15:47:47 +02:00
**Path —** `./config/server.js` .
```js
module.exports = {
host: 'localhost',
port: 1337,
cron: {
enabled: false,
},
admin: {
path: '/dashboard',
2019-05-06 16:17:16 +02:00
},
2020-04-10 15:47:47 +02:00
};
2019-05-06 16:17:16 +02:00
```
2020-03-22 13:28:03 -04:00
The panel will be available through [http://localhost:1337/dashboard ](http://localhost:1337/dashboard ) with the configurations above.
2019-12-12 14:47:35 +01:00
## Change the host
By default, the administration panel client host name is `localhost` . However, you can change this setting by updating the `admin` configuration:
2020-04-10 15:47:47 +02:00
**Path —** `./config/server.js` .
2019-12-12 14:47:35 +01:00
2020-04-10 15:47:47 +02:00
```js
module.exports = {
host: 'localhost',
port: 1337,
cron: {
enabled: false,
2019-12-12 14:47:35 +01:00
},
2020-04-10 15:47:47 +02:00
admin: {
host: 'my-host',
},
};
2019-12-12 14:47:35 +01:00
```
2019-10-09 12:32:58 +02:00
## Development mode
2019-05-06 16:17:16 +02:00
2019-10-01 17:54:35 +02:00
To enable the front-end development mode you need to start your application using the `--watch-admin` flag.
2019-09-24 14:43:17 +02:00
```bash
cd my-app
2019-09-26 11:52:02 +02:00
strapi develop --watch-admin
2019-09-24 14:43:17 +02:00
```
2019-10-01 17:54:35 +02:00
With this option you can do the following:
2019-09-24 14:43:17 +02:00
2019-10-09 12:32:58 +02:00
### Customize the `strapi-admin` package
2019-09-24 14:43:17 +02:00
All files added in `my-app/admin/src/` will either be replaced or added
**Example: Changing the available locales of your application**
```bash
2019-10-02 17:45:09 +02:00
# Create both the admin and admin/src/translations folders
cd my-app & & mkdir -p admin/src/translations
2019-09-24 14:43:17 +02:00
# Change the available locales of the administration panel
2019-09-26 11:52:02 +02:00
touch admin/src/i18n.js
2019-10-02 17:45:09 +02:00
# Change the import and exports of the translations files
touch admin/src/translations/index.js
2019-09-24 14:43:17 +02:00
```
2019-10-04 15:05:58 +02:00
**Path --** `my-app/admin/src/translations/index.js`
2019-10-02 17:45:09 +02:00
```js
import en from './en.json';
import fr from './fr.json';
const trads = {
en,
fr,
};
export default trads;
```
2019-11-07 12:05:39 +01:00
::: tip
2019-10-02 17:45:09 +02:00
With this modification only English and French will be available in your admin
:::
2019-09-24 14:43:17 +02:00
2019-10-09 12:32:58 +02:00
### Customize a plugin
2019-09-24 14:43:17 +02:00
Similarly to the back-end override system any file added in `my-app/extensions/<plugin-name>/admin/` will be copied and used instead of the original one (use with care).
**Example: Changing the current WYSIWYG**
```bash
cd my-app/extensions
# Create the content manager folder
mkdir content-manager & & cd content-manager
# Create the admin folder
2019-09-26 11:52:02 +02:00
mkdir -p admin/src
2019-09-24 14:43:17 +02:00
# Create the components folder and the WysiwygWithErrors one
2019-09-26 11:52:02 +02:00
cd admin/src & & mkdir -p components/WysiwygWithErrors
2019-09-24 14:43:17 +02:00
# Create the index.js so the original file is overridden
touch components/WysiwygWithErrors/index.js
```
2019-10-02 17:45:09 +02:00
**Path --** `my-app/extensions/content-manager/admin/src/components/WysiwygWithErrors/index.js`
2019-09-24 14:43:17 +02:00
```js
import React from 'react';
import MyNewWYSIWYG from 'my-awesome-lib';
// This is a dummy example
const WysiwygWithErrors = props => < MyNewWYSIWYG { . . . props } / > ;
export default WysiwygWithErrors;
```
2019-07-11 23:18:19 +02:00
### Styles
2019-07-12 08:02:25 +02:00
The AdminUI package source can be easily found in `./node_modules/strapi-admin/src/` .
2019-07-11 23:18:19 +02:00
2019-10-25 11:16:33 +03:00
For example, to change the top-left displayed admin panel's color, copy the `./node_modules/strapi-admin/admin/src/components/LeftMenuHeader` folder to `./admin/src/components/LeftMenuHeader` and change the styles inside `./admin/src/components/LeftMenuHeader/Wrapper.js` .
2019-07-11 23:18:19 +02:00
Thus, you are replacing the files that would normally be in `node_modules/strapi-admin/admin/src` and directing them to `admin/src/some/file/path` .
To apply your changes you need to rebuild your admin panel
```
npm run build
```
2019-05-06 16:17:16 +02:00
### Logo
2019-05-15 11:05:34 +02:00
To change the top-left displayed admin panel's logo, add your custom image at `./admin/src/assets/images/logo-strapi.png` .
2019-05-06 16:17:16 +02:00
2019-11-07 12:05:39 +01:00
::: tip
2019-05-06 16:17:16 +02:00
make sure the size of your image is the same as the existing one (434px x 120px).
:::
2019-07-31 14:06:31 +02:00
### Tutorial videos
To disable the information box containing the tutorial videos, create a file at `./admin/src/config.js`
Add the following configuration:
```js
2020-03-04 17:39:40 +01:00
export const LOGIN_LOGO = null;
2019-07-31 14:06:31 +02:00
export const SHOW_TUTORIALS = false;
2020-03-04 17:39:40 +01:00
export const SETTINGS_BASE_URL = '/settings';
2019-07-31 14:06:31 +02:00
```
2019-12-12 14:47:35 +01:00
### Changing the port
By default, the front-development server runs on the `8000` port. However, you can change this setting by updating the following configuration:
2020-04-10 15:47:47 +02:00
**Path —** `./config/server.js` .
2019-12-12 14:47:35 +01:00
2020-04-10 15:47:47 +02:00
```js
module.exports = {
host: 'localhost',
port: 1337,
cron: {
enabled: false,
},
admin: {
port: 3000,
2019-12-12 14:47:35 +01:00
},
2020-04-10 15:47:47 +02:00
};
2019-12-12 14:47:35 +01:00
```
2019-09-24 17:44:50 +02:00
## Build
To build the administration, run the following command from the root directory of your project.
2019-11-07 12:05:39 +01:00
:::: tabs
2019-09-24 17:44:50 +02:00
2019-11-07 12:05:39 +01:00
::: tab yarn
2019-07-31 14:06:31 +02:00
```
2019-09-24 17:44:50 +02:00
yarn build
2019-07-31 14:06:31 +02:00
```
2019-09-24 17:44:50 +02:00
:::
2019-05-06 16:17:16 +02:00
2019-11-07 12:05:39 +01:00
::: tab npm
2019-05-06 16:17:16 +02:00
2019-09-24 17:44:50 +02:00
```
2019-05-15 11:05:34 +02:00
npm run build
2019-05-06 16:17:16 +02:00
```
2019-09-24 17:44:50 +02:00
:::
2019-11-07 12:05:39 +01:00
::: tab strapi
2019-09-24 17:44:50 +02:00
```
strapi build
```
:::
::::
This will replace the folder's content located at `./build` . Visit [http://localhost:1337/admin ](http://localhost:1337/admin ) to make sure your updates have been taken into account.