605315f54e68db53919a64b4bd9a291d0cc56984
[yaffs-website] / web / themes / contrib / bootstrap / docs / Sub-Theming.md
1 <!-- @file Instructions on how to sub-theme the Drupal Bootstrap base theme. -->
2 <!-- @defgroup sub_theming -->
3 # Sub-Theming
4
5 If you haven't already installed the Drupal Bootstrap theme, read 
6 the @link getting_started Getting Started @endlink topic. Below 
7 are instructions on how to create a [Drupal Bootstrap] based sub-theme.
8 There are several different variations on how to accomplish this task, but this
9 topic will focus on the two primarily and most common ways.
10
11 {.alert.alert-warning} **Warning** You should never modify any theme or sub-theme that 
12 is packaged and released from Drupal.org, such as Drupal Bootstrap. If you 
13 do, all changes you have made will be lost once that theme is updated. Instead, 
14 you should create a subtheme from one of the provided starterkits (this is 
15 considered a best practice). Once you've done that, you can override CSS, 
16 templates, and theme processing.
17
18 #### Choose a Starterkit {#starterkit}
19
20 - @link sub_theming_cdn CDN Starterkit @endlink - uses the "out-of-the-box"
21   CSS and JavaScript files served by the [jsDelivr CDN].
22 - @link sub_theming_less Less Starterkit @endlink - uses the [Bootstrap Framework]
23   [Less] source files and a local [Less] preprocessor.
24 - @link sub_theming_sass Sass Starterkit @endlink - uses the [Bootstrap Framework]
25   [Sass] source files and a local [Sass] preprocessor.
26
27 Once you've selected one of the above starterkits, here's how to install it:
28
29 1. Copy over one of the starterkits you have chosen from the
30    `./bootstrap/starterkits` directory into the `themes` directory.
31 2. Rename the directory to a unique machine readable name. This is your sub-theme's
32    "machine name". When referring to files inside a sub-theme, they will always
33    start with `./THEMENAME/`, where `THEMENAME` is the machine name of your
34    sub-theme. They will continue to specify the full path to the file or
35    directory inside it. For example, the primary file Drupal uses to determine
36    if a theme exists is: `./THEMENAME/THEMENAME.info.yml`.
37 3. Rename `./THEMENAME/THEMENAME.starterkit.yml` to match
38    `./THEMENAME/THEMENAME.info.yml`. Also, rename `./THEMENAME/THEMENAME.libraries.yml` 
39    and `./THEMENAME/THEMENAME.theme` as well.
40 4. Open `./THEMENAME/THEMENAME.info.yml` and change the name, description and any
41    other properties to suite your needs. Make sure to rename the library name as
42    well:  `- THEMENAME/global-styling`.
43 5. Rename the sub-theme configuration files, located at:
44    `./THEMENAME/config/install/THEMENAME.settings.yml` and
45    `./THEMENAME/config/schema/THEMENAME.schema.yml`.
46 6. Open `./THEMENAME/config/schema/THEMENAME.schema.yml` and rename
47    `- THEMENAME.settings:` and `'THEMETITLE settings'`
48
49 {.alert.alert-warning} **WARNING:** Ensure that the `.starterkit` suffix is
50 not present on your sub-theme's `.info.yml` filename. This suffix is simply a stop
51 gap measure to ensure that the bundled starter kit sub-theme cannot be enabled
52 or used directly. This helps people unfamiliar with Drupal avoid modifying the
53 starter kit sub-theme directly and instead forces them to create a new sub-theme
54 to modify.
55
56 #### Enable Your New Sub-theme {#enable}
57 In your Drupal site, navigate to `admin/appearance` and click the `Enable and
58 set default` link next to your newly created sub-theme. Now that you've enabled
59 your starterkit, please refer to the starterkit's documentation page to customize.
60
61
62 [Drupal Bootstrap]: https://www.drupal.org/project/bootstrap
63 [Bootstrap Framework]: http://getbootstrap.com
64 [jsDelivr CDN]: http://www.jsdelivr.com
65 [Less]: http://lesscss.org
66 [Sass]: http://sass-lang.com