Permalink
Browse files

Do minification with Grunt + Uglify.

Fixes #305, hopefully. And obviates the dependency on Google Closure, which is great.
  • Loading branch information...
1 parent ccaae9f commit a2f7e2c5065d37f365c38a9a91a3afa42272a64f @domenic domenic committed Jun 4, 2013
Showing with 36 additions and 39 deletions.
  1. +7 −15 CONTRIBUTING.md
  2. +20 −0 Gruntfile.js
  3. +1 −1 README.md
  4. +0 −2 minify
  5. +7 −2 package.json
  6. +1 −19 q.min.js
  7. BIN q.min.js.gz
View
@@ -1,12 +1,12 @@
For pull requests:
-- Be consistent with prevelant style and design decisions.
+- Be consistent with prevalent style and design decisions.
- Add a Jasmine spec to `specs/q-spec.js`.
- Use `npm test` to avoid regressions.
- Run tests in `q-spec/run.html` in as many supported browsers as you
can find the will to deal with.
-- You do not need to build minified versions.
+- Do not build minified versions; we do this each release.
- If you would be so kind, add a note to `CHANGES.md` in an
appropriate section:
@@ -21,23 +21,15 @@ For releases:
- Run tests in `q-spec/run.html` in a representative sample of every
browser under the sun.
- Run `npm run cover` and make sure you're happy with the results.
-- Arrange for the Google Closure Compiler to be available as a
- `closure` command then run `source minify` to build `q.min.js` and
- `q.min.js.gz` and commit with `Minify`.
-
- ```bash
- #!/bin/bash
- java -jar `which closure.jar` $@
- ```
-
-- Note the size of `q.min.js.gz` in `README.md` if it has changed to 1
- significant digit.
+- Run `npm run minify` and be sure to commit the resulting `q.min.js`.
+- Note the Gzipped size output by the previous command, and update
+ `README.md` if it has changed to 1 significant digit.
- Stash any local changes.
- Update `CHANGES.md` to reflect all changes in the differences
between `HEAD` and the previous tagged version. Give credit where
credit is due.
-- Update `README.md` to address all new, non-expiermental features.
-- Update the API reference on the Wiki to reflect all non-expiermental
+- Update `README.md` to address all new, non-experimental features.
+- Update the API reference on the Wiki to reflect all non-experimental
features.
- Use `npm version major|minor|patch` to update `package.json`,
commit, and tag the new version.
View
@@ -0,0 +1,20 @@
+"use strict";
+
+module.exports = function (grunt) {
+ grunt.loadNpmTasks("grunt-contrib-uglify");
+
+ grunt.initConfig({
+ uglify: {
+ options: {
+ report: "gzip"
+ },
+ dist: {
+ files: {
+ "q.min.js": ["q.js"]
+ }
+ }
+ }
+ });
+
+ grunt.registerTask("default", ["uglify"]);
+};
View
@@ -66,7 +66,7 @@ rest and spread arguments.
The Q module can be loaded as:
-- A ``<script>`` tag (creating a ``Q`` global variable): ~3 KB minified and
+- A ``<script>`` tag (creating a ``Q`` global variable): ~2.5 KB minified and
gzipped.
- A Node.js and CommonJS module, available in [npm](https://npmjs.org/) as
the [q](https://npmjs.org/package/q) package
View
@@ -1,2 +0,0 @@
-closure < q.js > q.min.js
-gzip < q.min.js > q.min.js.gz
View
@@ -48,13 +48,18 @@
"cover": "*",
"jasmine-node": "1.2.2",
"opener": "*",
- "promises-aplus-tests": "1.x"
+ "promises-aplus-tests": "1.x",
+ "grunt": "~0.4.1",
+ "grunt-cli": "~0.1.9",
+ "grunt-contrib-uglify": "~0.2.2"
},
"scripts": {
"test": "jasmine-node spec && promises-aplus-tests spec/aplus-adapter",
"test-browser": "opener spec/q-spec.html",
"lint": "jshint q.js",
- "cover": "cover run node_modules/jasmine-node/bin/jasmine-node spec && cover report html && opener cover_html/index.html"
+ "cover": "cover run node_modules/jasmine-node/bin/jasmine-node spec && cover report html && opener cover_html/index.html",
+ "minify": "grunt",
+ "prepublish": "grunt"
},
"overlay": {
"teleport": {
View
Oops, something went wrong.
View
Binary file not shown.

0 comments on commit a2f7e2c

Please sign in to comment.