Skip to content

Commit db1cb79

Browse files
committed
Merge pull request #73 from DaQuirm/source-map
Source map
2 parents 46b271f + 678dbb6 commit db1cb79

File tree

3 files changed

+61
-33
lines changed

3 files changed

+61
-33
lines changed

Gruntfile.js

+26-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
module.exports = function(grunt) {
22
grunt.initConfig({
33
pkg: grunt.file.readJSON('package.json'),
4-
4+
55
qunit: {
66
files: ['test/index.html']
77
},
88

9+
copy: {
10+
build: {
11+
src: '<%= pkg.name %>.js',
12+
dest: 'dist/<%= pkg.name %>.js'
13+
}
14+
},
15+
916
uglify: {
1017
options: {
1118
banner: '/*!\n' +
@@ -18,17 +25,31 @@ module.exports = function(grunt) {
1825
'*\n' +
1926
'* Date: <%= grunt.template.today("yyyy-mm-dd") %>\n' +
2027
'*\n' +
21-
'*/\n'
28+
'*/\n',
29+
sourceMap: true
2230
},
2331
dist: {
2432
files: {'dist/<%= pkg.name %>.min.js' : ['<%= pkg.name %>.js']}
2533
}
34+
},
35+
36+
sourcemap_localize: {
37+
options: {
38+
localize_to : '..'
39+
},
40+
build: {
41+
files: {
42+
src: ['dist/*.min.map']
43+
}
44+
}
2645
}
2746
});
2847

29-
grunt.loadNpmTasks("grunt-contrib-qunit");
30-
grunt.loadNpmTasks("grunt-contrib-uglify");
48+
grunt.loadNpmTasks("grunt-contrib-copy");
49+
grunt.loadNpmTasks("grunt-contrib-qunit");
50+
grunt.loadNpmTasks("grunt-contrib-uglify");
51+
grunt.loadNpmTasks('grunt-sourcemap-localize');
3152
grunt.registerTask('test', 'qunit');
3253
grunt.registerTask('default', ['qunit']);
33-
grunt.registerTask('build', ['qunit', 'uglify']);
54+
grunt.registerTask('build', ['qunit', 'copy', 'uglify', 'sourcemap_localize']);
3455
};

README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ VerbalExpressions v0.1.2
55
VerbalExpressions is a JavaScript library that helps to construct difficult regular expressions.
66

77
## Other Implementations
8-
You can see an up to date list of all ports on [VerbalExpressions.github.io](http://VerbalExpressions.github.io).
8+
You can see an up to date list of all ports on [VerbalExpressions.github.io](http://VerbalExpressions.github.io).
99
- [Ruby](https://github.com/ryan-endacott/verbal_expressions)
1010
- [C#](https://github.com/VerbalExpressions/CSharpVerbalExpressions)
1111
- [Python](https://github.com/VerbalExpressions/PythonVerbalExpressions)
@@ -35,7 +35,7 @@ var VerEx = require("verbal-expressions");
3535

3636
## Running tests
3737

38-
$ grunt
38+
$ grunt
3939
(or)
4040
$ grunt test
4141

@@ -45,6 +45,8 @@ This will generate a minified version of VerbalExpressions.js (aptly named Verba
4545

4646
$ grunt build
4747

48+
A source map will also be created in the same folder, so you can use the original unminified source file (copied to _dist_ as well) for debugging purposes.
49+
4850
## Examples
4951

5052
Here's a couple of simple examples to give an idea of how VerbalExpressions works:
@@ -69,7 +71,7 @@ var testMe = "https://www.google.com";
6971
if( tester.test( testMe ) ) alert( "We have a correct URL "); // This output will fire
7072
else alert( "The URL is incorrect" );
7173

72-
console.log( tester ); // Ouputs the actual expression used: /^(http)(s)?(\:\/\/)(www\.)?([^\ ]*)$/
74+
console.log( tester ); // Ouputs the actual expression used: /^(http)(s)?(\:\/\/)(www\.)?([^\ ]*)$/
7375
```
7476

7577
### Replacing strings

package.json

+30-25
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,32 @@
11
{
2-
"name": "VerbalExpressions",
3-
"description": "JavaScript Regular expressions made easy",
4-
"version": "0.1.2",
5-
"keywords": [ "regular expressions", "regex" ],
6-
"homepage": "https://github.com/VerbalExpressions/JSVerbalExpressions",
7-
"devDependencies": {
8-
"grunt": "~0.4.2",
9-
"grunt-contrib-qunit": "~0.2.2",
10-
"grunt-contrib-uglify": "~0.2.2"
11-
},
12-
"repository": {
13-
"type": "git",
14-
"url": "git://github.com/VerbalExpressions/JSVerbalExpressions.git"
15-
},
16-
"bugs": {
17-
"url": "https://github.com/VerbalExpressions/JSVerbalExpressions/issues"
18-
},
19-
"main": "VerbalExpressions.js",
20-
"license": {
21-
"type": "MIT",
22-
"url": "http://opensource.org/licenses/MIT"
23-
},
24-
"engines": {
25-
"node": ">= 0.8.0"
26-
}
2+
"name": "VerbalExpressions",
3+
"description": "JavaScript Regular expressions made easy",
4+
"version": "0.1.2",
5+
"keywords": [
6+
"regular expressions",
7+
"regex"
8+
],
9+
"homepage": "https://github.com/VerbalExpressions/JSVerbalExpressions",
10+
"devDependencies": {
11+
"grunt": "~0.4.2",
12+
"grunt-contrib-qunit": "~0.2.2",
13+
"grunt-contrib-uglify": "~0.3.0",
14+
"grunt-sourcemap-localize": "~0.1.0",
15+
"grunt-contrib-copy": "~0.5.0"
16+
},
17+
"repository": {
18+
"type": "git",
19+
"url": "git://github.com/VerbalExpressions/JSVerbalExpressions.git"
20+
},
21+
"bugs": {
22+
"url": "https://github.com/VerbalExpressions/JSVerbalExpressions/issues"
23+
},
24+
"main": "VerbalExpressions.js",
25+
"license": {
26+
"type": "MIT",
27+
"url": "http://opensource.org/licenses/MIT"
28+
},
29+
"engines": {
30+
"node": ">= 0.8.0"
31+
}
2732
}

0 commit comments

Comments
 (0)