Skip to content

Commit

Permalink
Do minification with Grunt + Uglify.
Browse files Browse the repository at this point in the history
Fixes kriskowal#305, hopefully. And obviates the dependency on Google Closure, which is great.
  • Loading branch information
domenic committed Jun 4, 2013
1 parent ccaae9f commit a2f7e2c
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 39 deletions.
22 changes: 7 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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:

Expand All @@ -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.
Expand Down
20 changes: 20 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -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"]);
};
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions minify

This file was deleted.

9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
20 changes: 1 addition & 19 deletions q.min.js

Large diffs are not rendered by default.

Binary file removed q.min.js.gz
Binary file not shown.

0 comments on commit a2f7e2c

Please sign in to comment.