Skip to content

Commit e0639dd

Browse files
committed
Issue #2462635: CSS overrides isn't compatible with Bootswatch themes
Issue #2348843: Add Grunt for project maintainer workflow Conflicts: css/overrides.css includes/alter.inc
1 parent d3b146b commit e0639dd

File tree

385 files changed

+133221
-104
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

385 files changed

+133221
-104
lines changed

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1+
# OS
12
.DS_Store
3+
4+
# Applications & Tools
25
.idea
36
bower_components
47
config.codekit
58
node_modules
9+
npm-debug.log
10+
11+
# Project Specific
12+
.libraries
13+
lib
614
starterkits/*/bootstrap

Gruntfile.js

+13-76
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,20 @@
1+
var path = require('path');
2+
13
module.exports = function (grunt) {
4+
// Record grunt task execution times. Must be first.
5+
require('time-grunt')(grunt);
26

3-
// Project configuration.
4-
grunt.initConfig({
5-
pkg: grunt.file.readJSON('package.json'),
6-
bower: {
7-
install: {
8-
options: {
9-
copy: false
10-
}
11-
}
12-
},
13-
clean: {
14-
css: ['css/**/*']
15-
},
16-
githooks: {
17-
install: {
18-
options: {
19-
template: '.githooks.js.hbs'
20-
},
21-
// Change to something else once the {{ hook }} variable can be used.
22-
// @see https://github.com/wecodemore/grunt-githooks/pull/40
23-
'pre-commit': 'pre-commit',
24-
'post-merge': 'post-merge',
25-
'post-checkout': 'post-checkout'
26-
}
27-
},
28-
less: {
29-
overrides: {
30-
src: 'starterkits/less/less/overrides.less',
31-
dest: 'css/overrides.css',
32-
options: {
33-
cleancss: true,
34-
compress: true
35-
}
36-
}
37-
},
38-
symlink: {
39-
options: {
40-
overwrite: true
41-
},
42-
less: {
43-
src: 'bower_components/bootstrap',
44-
dest: 'starterkits/less/bootstrap'
45-
}
46-
},
47-
watch: {
48-
plugin: {
49-
files: ['starterkits/less/**/*.less'],
50-
tasks: ['compile']
51-
}
52-
}
53-
});
7+
// Register the "default" task.
8+
grunt.registerTask('default', ['compile']);
549

55-
// Load the grunt plugins.
56-
grunt.loadNpmTasks('grunt-contrib-clean');
57-
grunt.loadNpmTasks('grunt-contrib-less');
58-
grunt.loadNpmTasks('grunt-contrib-symlink');
59-
grunt.loadNpmTasks('grunt-contrib-watch');
60-
grunt.loadNpmTasks('grunt-bower-task');
61-
grunt.loadNpmTasks('grunt-githooks');
10+
// Register the "install" task.
11+
grunt.registerTask('install', 'Installs or re-installs this grunt project. Read more in: MAINTAINERS.md.', ['githooks', 'sync']);
6212

63-
// Install tasks.
64-
grunt.registerTask('install', 'Installs the grunt project. NOTE: Only needs to be ran once and should have be done automatically via npm postinstall!', function () {
65-
// Install bower and setup symlinks.
66-
grunt.task.run(['githooks', 'bower', 'symlink']);
13+
// Load custom tasks.
14+
grunt.task.loadTasks('grunt');
6715

68-
// Ensure there are no files in the vendor paths that may conflict with
69-
// Drupal. @see https://www.drupal.org/node/2329453
70-
var files = grunt.file.expand(['node_modules/**/*.info', 'bower_components/**/*.info']);
71-
files.forEach(function(file) {
72-
grunt.file.delete(file, { force: true });
73-
grunt.log.verbose('Removed conflicting Drupal file "' + file.dest + '".');
74-
});
16+
// Load npm installed 'grunt-*' tasks and configurations.
17+
require('load-grunt-config')(grunt, {
18+
configPath: path.join(process.cwd(), 'grunt', 'config')
7519
});
76-
77-
// Compile tasks.
78-
grunt.registerTask('compile', 'Compiles the base theme overrides CSS.', ['clean', 'less']);
79-
80-
// Default tasks.
81-
grunt.registerTask('default', ['compile']);
82-
8320
};

MAINTAINERS.md

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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.

bower.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "drupal-bootstrap",
3-
"version": "7.3.0-dev",
4-
"dependencies": {
5-
"bootstrap": "3.3.5"
6-
}
3+
"version": "7.3.x-dev",
4+
"license": "GPL+2",
5+
"homepage": "https://www.drupal.org/project/bootstrap",
6+
"private": true
77
}

0 commit comments

Comments
 (0)