diff --git a/.gitignore b/.gitignore index c2658d7..b947077 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ node_modules/ +dist/ diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 97ea7ee..77e1c2e 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -2,6 +2,7 @@ module.exports = (grunt) -> grunt.loadNpmTasks 'grunt-contrib-watch' grunt.loadNpmTasks 'grunt-contrib-uglify' grunt.loadNpmTasks 'grunt-contrib-jshint' + grunt.loadNpmTasks 'grunt-dist' grunt.initConfig( pkg: grunt.file.readJSON 'package.json' uglify: @@ -19,6 +20,10 @@ module.exports = (grunt) -> eqeqeq: true trailing: true files: ['src/hotkeys.js'] + dist: + default_options: + files: + "dist":['src/hotkeys.js'] watch: another: files: ['src/*.js'] diff --git a/README.md b/README.md index 4866928..2d02eef 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,29 @@ [](https://github.com/jaywcjlove/hotkeys/issues) [](https://github.com/jaywcjlove/hotkeys/network) [](https://github.com/jaywcjlove/hotkeys/stargazers) [](https://github.com/jaywcjlove/hotkeys/releases) -这又是在重复造轮子,呵呵~!! +自定义快捷键没有依赖。这又是在重复造轮子,呵呵~!! -## 下载 +## 创建 -### bower -Run `bower info hotkeysjs` to list the available versions. -下载 `bower install hotkeysjs` +您将需要在您的系统上安装的 Node.js。 + +```sh +# npm 安装 +$ bower install hotkeysjs + +# npm 安装 +$ npm install hotkeys-js + +# 在页面上引用需要压缩的话,运行 +$ grunt dist + +# 在dist目录中生成下列文件: +# dist/hotkeys.js +# dist/hotkeys.min.js +# dist/hotkeys.min.map +``` -### npm -下载 `npm install hotkeys-js` ## 定义快捷键 diff --git a/package.json b/package.json index 8e92174..80ddf9a 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "grunt": "^0.4.5", "grunt-contrib-jshint": "^0.11.2", "grunt-contrib-uglify": "^0.9.1", - "grunt-contrib-watch": "^0.6.1" + "grunt-contrib-watch": "^0.6.1", + "grunt-dist": "0.0.3" } } diff --git a/test/test.html b/test/test.html index ab2d394..b6f9195 100644 --- a/test/test.html +++ b/test/test.html @@ -6,6 +6,21 @@
- + + +