Skip to content

Commit 46b271f

Browse files
committed
Merge pull request #72 from kevcenteno/gruntMin
Added "grunt build" task to create minified version
2 parents 427b18c + aec1fce commit 46b271f

File tree

5 files changed

+39
-4
lines changed

5 files changed

+39
-4
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
22
.DS_Store
3+
dist

Gruntfile.js

+23
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,34 @@
11
module.exports = function(grunt) {
22
grunt.initConfig({
3+
pkg: grunt.file.readJSON('package.json'),
4+
35
qunit: {
46
files: ['test/index.html']
7+
},
8+
9+
uglify: {
10+
options: {
11+
banner: '/*!\n' +
12+
'* <%= pkg.name %> JavaScript Library v<%= pkg.version %>\n' +
13+
'* <%= pkg.homepage %>\n' +
14+
'*\n' +
15+
'*\n' +
16+
'* Released under the <%= pkg.license.type %> license\n' +
17+
'* <%= pkg.license.url %>\n' +
18+
'*\n' +
19+
'* Date: <%= grunt.template.today("yyyy-mm-dd") %>\n' +
20+
'*\n' +
21+
'*/\n'
22+
},
23+
dist: {
24+
files: {'dist/<%= pkg.name %>.min.js' : ['<%= pkg.name %>.js']}
25+
}
526
}
627
});
728

829
grunt.loadNpmTasks("grunt-contrib-qunit");
30+
grunt.loadNpmTasks("grunt-contrib-uglify");
931
grunt.registerTask('test', 'qunit');
1032
grunt.registerTask('default', ['qunit']);
33+
grunt.registerTask('build', ['qunit', 'uglify']);
1134
};

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ var VerEx = require("verbal-expressions");
3939
(or)
4040
$ grunt test
4141

42+
## Creating a minified version
43+
44+
This will generate a minified version of VerbalExpressions.js (aptly named VerbalExpressions.min.js) in a _dist_ folder.
45+
46+
$ grunt build
47+
4248
## Examples
4349

4450
Here's a couple of simple examples to give an idea of how VerbalExpressions works:

VerbalExpressions.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
*
66
* Released under the MIT license
7-
* http://jquery.org/license
7+
* http://opensource.org/licenses/MIT
88
*
99
* Date: 2013-07-19
1010
*

package.json

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
{
2-
"name": "verbal-expressions",
2+
"name": "VerbalExpressions",
33
"description": "JavaScript Regular expressions made easy",
44
"version": "0.1.2",
55
"keywords": [ "regular expressions", "regex" ],
6+
"homepage": "https://github.com/VerbalExpressions/JSVerbalExpressions",
67
"devDependencies": {
78
"grunt": "~0.4.2",
8-
"grunt-contrib-qunit": "~0.2.2"
9+
"grunt-contrib-qunit": "~0.2.2",
10+
"grunt-contrib-uglify": "~0.2.2"
911
},
1012
"repository": {
1113
"type": "git",
@@ -15,7 +17,10 @@
1517
"url": "https://github.com/VerbalExpressions/JSVerbalExpressions/issues"
1618
},
1719
"main": "VerbalExpressions.js",
18-
"license": "MIT",
20+
"license": {
21+
"type": "MIT",
22+
"url": "http://opensource.org/licenses/MIT"
23+
},
1924
"engines": {
2025
"node": ">= 0.8.0"
2126
}

0 commit comments

Comments
 (0)