|
| 1 | +# Maintaining the Drupal Bootstrap Project |
| 2 | + |
| 3 | +## Prerequisites |
| 4 | +This project relies heavily on NodeJS/Grunt to automate some very time |
| 5 | +consuming tasks and to ensure effective management. If you do not have these |
| 6 | +CLI tools, please install them now: |
| 7 | + |
| 8 | +* https://nodejs.org |
| 9 | +* http://gruntjs.com |
| 10 | + |
| 11 | +## Installation |
| 12 | + |
| 13 | +This project's installation may initially take a while to complete. Please read |
| 14 | +through this entire README before continuing so you are aware of what to expect. |
| 15 | +Suffice it to say: you will not have to manually update this project again. |
| 16 | + |
| 17 | +After you have installed the prerequisite CLI tools, run `npm install` in this |
| 18 | +directory. This will install the necessary NodeJS modules inside the |
| 19 | +`node_modules` folder. |
| 20 | + |
| 21 | +After NodeJS has finished installing its own modules, it will automatically |
| 22 | +invoke `grunt install` for you. This is a grunt task that is specifically |
| 23 | +designed to keep the project in sync amongst maintainers. |
| 24 | + |
| 25 | +## Grunt |
| 26 | +There are several tasks available to run, please execute `grunt --help` to view |
| 27 | +the full list of tasks currently available. This README only covers the most |
| 28 | +important or commonly used tasks. |
| 29 | + |
| 30 | +### `grunt install` |
| 31 | +This task is automatically invoked as a `postinstall` event of `npm install`. |
| 32 | +There should be no need to manually invoke this task. However, if you feel the |
| 33 | +need to manual invoke this task, you may do so without fear of producing any |
| 34 | +unintended side-effects. This is simply an alias for sub-tasks defined below. |
| 35 | + |
| 36 | +### `grunt githooks` |
| 37 | +This is a sub-task of `grunt install`. It will automatically install the |
| 38 | +necessary git hooks for this project. These git hooks allow the project to keep |
| 39 | +track of changes to files in order to automate and ensure certain files are |
| 40 | +committed (e.g. compiled CSS files). Do not worry, if you already have existing |
| 41 | +git hook files in place, this will work around them. |
| 42 | + |
| 43 | +Any time there is a change to `package.json`, `Gruntfile.js`, `.githooks.js.hbs` |
| 44 | +or any of the files in the `grunt` subdirectory, the `npm install` task will |
| 45 | +automatically be executed by the git hook itself. This allows the workflow to |
| 46 | +be altered by one maintainer and those changes propagated to the others the |
| 47 | +next time they pull down the repository. |
| 48 | + |
| 49 | +### `grunt sync` |
| 50 | +This is a sub-task used by `grunt install`. It will automatically |
| 51 | +download and install the various 3.x.x versions of the Bootstrap and Bootswatch |
| 52 | +libraries for local development purposes in the `./lib` folder. This process |
| 53 | +utilizes Bower and can initially take a while for it to fully complete. |
| 54 | + |
| 55 | +Once you have the various versions of libraries have been installed, this task |
| 56 | +becomes much faster. This task utilizes the jsDelivr API to determine which |
| 57 | +versions to install. To avoid abusing API calls, this list is cached for one |
| 58 | +week as the `.libraries` file in the root of this project. In the event that a |
| 59 | +new list needs to be generated and the week cache expiration has not lifted, |
| 60 | +you can either simply remove the file manually or run `grunt sync --force` to |
| 61 | +force an API call and generate a new list. |
| 62 | + |
| 63 | +### `grunt compile` |
| 64 | +This task ensures that all the necessary variations of versions and themes of |
| 65 | +Bootstrap and Bootswatch are compile from `starterkits/less/less/overrides.less`. |
| 66 | +Typically, this task generates hundreds of files and can take upwards of |
| 67 | +\~10 seconds to fully complete. |
| 68 | + |
| 69 | +Optionally, if the `--dev` parameter is specified, this task will only compile |
| 70 | +the starterkit's `overrides.less` file for the latest version of Bootstrap: |
| 71 | +* `./css/<%= latestVersion/overrides.css` |
| 72 | +* `./css/<%= latestVersion/overrides.min.css` |
| 73 | + |
| 74 | +### `grunt watch` |
| 75 | +This task is responsible for watching various source files and executing the |
| 76 | +appropriate tasks these source files are normally consumed by. With the caveat |
| 77 | +of long compilation times mentioned in the previous section, it is highly |
| 78 | +recommended running this task as such: `grunt watch --dev`. Keep in mind that |
| 79 | +this limits the rapid development of the `overrides.less` file to the default |
| 80 | +Bootstrap theme. If you have switched themes, you must manually compile all |
| 81 | +the version and theme override files. |
0 commit comments