[buddypress-trac] [BuddyPress Trac] #5821: Update grunt build tools - Fixes JS & CSS build process

buddypress-trac noreply at wordpress.org
Tue Aug 19 13:36:19 UTC 2014


#5821: Update grunt build tools - Fixes JS & CSS build process
--------------------------+-----------------------
 Reporter:  netweb        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  highest       |  Milestone:  2.1
Component:  Core          |    Version:
 Severity:  blocker       |   Keywords:  has-patch
--------------------------+-----------------------
 First up, no changes in the following affect the current Grunt build tools
 workflow, everything remains the same.

 Gruntfile.js:
 * Removes legacy `grunt watch` grunt tasks from `cssjanus`, `clean`,
 `copy`, variable `path`, `grunt.event.on` and `grunt:config` dynamic
 options. There is no longer any watch tasks in the BuddyPress build tools,
 see r8550

 * Add's grunt task option `extDot: 'last',` to Grunt tasks `cssjanus`,
 `uglify` and `cssmin` to allow support for files with dot/period
 filenames, e.g. `jquery.atwho.js` (previously uglify/minify this file
 resulted a file named `jquery.min.js`)

 * Removes the Grunt CSS task `cssmin:rtl` and `cssmin:ltr` with a single
 `cssmin:minify` task, we are only minifying the build folder CSS so all
 CSS files can be minified with a single task.

 * Added JSValidate task `jsvalidate:src` to validate JavaScript files in
 the `/src` folder, previously JavaScript files where only validated after
 running `grunt build-release`.

 * Grunt task `grunt build` now uses `jsvalidate:src` to verify JavaScript
 files in the `/src` folder, previously it was only validating JavaScript
 files in the `/build` folder.
 CSS:
 * Fixes an issue where the RTL CSS of the file `jquery.autocompletefb.css`
 was created using the filename `jquery-rtl.css`, this is fixed with SVN
 rename so the filename is now `jquery.autocompletefb-rtl.css` and the
 associated Grunt task now fixes this with the `extDot: 'last'` task
 option.

 * CSS is simplified with `BP_CSS` = `**/*.css` for all CSS files with an
 exclusion list in `BP_EXCLUDED_CSS` which excludes RTL CSS primarily from
 the Grunt task `cssjanus` so that standard `example.css` files only have
 have RTL files with the extension of `example-rtl.css` created in the
 `/src` folder as part of `grunt build` and `grunt build-commit` tasks as
 the RTL files are committed to the `/src` repo of BuddyPress.

 JavaScript:
 * The JavaScript file inclusion is simplified with `BP_JS` = `**/*.js` for
 all JavaScript files with an exclusion list in `BP_EXCLUDED_JS` which is
 then excluded in the Grunt task `grunt jsint` so 3rd party JavaScript
 files do not fail BuddyPress JSHint standards, each JavaScript file is
 still validated with the `grunt jsvalidate` task though.

 JShint:
 * Two explicit JSHint exclusions are added to BuddyPress deprecated files
 to allow them to pass the Grunt task `grunt jshint` (This could be
 switched to include them in `BP_EXCLUDED_JS` and was an either/or choice
 so I chose as they are BuddyPress "Core" files and not 3rd party to add
 the JSHint exclusion.

  * `src/bp-templates/bp-legacy/js/password-verify.js`

  * `src/bp-templates/bp-legacy/js/buddypress.js`

 Node Dependencies:
 * Updates `grunt-contrib-imagemin` from `~0.7.1` to `~0.8.0`

 * Updates `grunt-wp-i18n` from `~0.4.6` to `~0.4.7`

 * Removes unused `grunt-phpunit`

 Line Endings:
 * All CSS and JavaScript files now include a blank line end of the file
 inline with coding standards.

 Inline docs and whitespace:
 * A couple of minor docs formatting and updates

 * A couple whitespace and coding formatting updates

 ToDo:
 * After this commit, sort the tasks alphabetically (It made the patch look
 like a dogs breakfast if included here)
 ----

 In summary the following workflow performs the following (including order
 of execution):

 * `grunt build`:
  * Using `jsvalidate:src` validates all 20 JavaScript (12 Core & 8 3rd
 party) files in the `/src` folder
  * Using `jshint` lints all 12 BuddyPress Core JavaScript files in the
 `/src` folder
  * Using `cssjanus` converts all 10 BuddyPress CSS files to RTL
 equivalents in the `/src` folder

 * grunt `build-commit` calls `grunt build` tasks above and:
  * Using `checktextdomain` to check i18n text domain for all PHP files
  * Using `imagemin` minimize all images in the `/src` folder

 * grunt `build-release` calls `grunt build-commit` and `grunt build` tasks
 above and:
  * Using `clean:all` cleans the `/build` folder
  * Using `copy:all` copies all files and folders from `/src` to the
 `/build` folder
  * Using `uglify` minimizes all 20 JavaScript files (12 Core & 8 3rd
 party) in the `/build` folder
  * Using `jsvalidate:build` validates all 40 JavaScript files (20 Core &
 20 minimized) in the `/build` folder
  * Using `cssmin` minimizes all 20 CSS files (10 LTR CSS & 10 RTL CSS) in
 the `/build` folder
  * Using `makepot` creates the `buddypress.pot` file in the root of the
 `/build` folder
  * Using `exec:bbpress` to SVN checkout bbPress 1.2 into the `/build/bp-
 forums` folder
  * Using `exec:bpdefault` to SVN checkout BP-Default into the `/build/bp-
 themes/bp-default` folder
  * Using `test` to run the PHPUnit Grunt task to run PHPUnit single site
 and multi site PHPUnit tests

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5821>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list