Skip to content

Commit

Permalink
Merge pull request #73 from DaQuirm/source-map
Browse files Browse the repository at this point in the history
Source map
  • Loading branch information
mihai-vlc committed Jan 18, 2014
2 parents 46b271f + 678dbb6 commit db1cb79
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 33 deletions.
31 changes: 26 additions & 5 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

qunit: {
files: ['test/index.html']
},

copy: {
build: {
src: '<%= pkg.name %>.js',
dest: 'dist/<%= pkg.name %>.js'
}
},

uglify: {
options: {
banner: '/*!\n' +
Expand All @@ -18,17 +25,31 @@ module.exports = function(grunt) {
'*\n' +
'* Date: <%= grunt.template.today("yyyy-mm-dd") %>\n' +
'*\n' +
'*/\n'
'*/\n',
sourceMap: true
},
dist: {
files: {'dist/<%= pkg.name %>.min.js' : ['<%= pkg.name %>.js']}
}
},

sourcemap_localize: {
options: {
localize_to : '..'
},
build: {
files: {
src: ['dist/*.min.map']
}
}
}
});

grunt.loadNpmTasks("grunt-contrib-qunit");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.loadNpmTasks("grunt-contrib-qunit");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks('grunt-sourcemap-localize');
grunt.registerTask('test', 'qunit');
grunt.registerTask('default', ['qunit']);
grunt.registerTask('build', ['qunit', 'uglify']);
grunt.registerTask('build', ['qunit', 'copy', 'uglify', 'sourcemap_localize']);
};
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ VerbalExpressions v0.1.2
VerbalExpressions is a JavaScript library that helps to construct difficult regular expressions.

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

## Running tests

$ grunt
$ grunt
(or)
$ grunt test

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

$ grunt build

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.

## Examples

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

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

### Replacing strings
Expand Down
55 changes: 30 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,32 @@
{
"name": "VerbalExpressions",
"description": "JavaScript Regular expressions made easy",
"version": "0.1.2",
"keywords": [ "regular expressions", "regex" ],
"homepage": "https://github.com/VerbalExpressions/JSVerbalExpressions",
"devDependencies": {
"grunt": "~0.4.2",
"grunt-contrib-qunit": "~0.2.2",
"grunt-contrib-uglify": "~0.2.2"
},
"repository": {
"type": "git",
"url": "git://github.com/VerbalExpressions/JSVerbalExpressions.git"
},
"bugs": {
"url": "https://github.com/VerbalExpressions/JSVerbalExpressions/issues"
},
"main": "VerbalExpressions.js",
"license": {
"type": "MIT",
"url": "http://opensource.org/licenses/MIT"
},
"engines": {
"node": ">= 0.8.0"
}
"name": "VerbalExpressions",
"description": "JavaScript Regular expressions made easy",
"version": "0.1.2",
"keywords": [
"regular expressions",
"regex"
],
"homepage": "https://github.com/VerbalExpressions/JSVerbalExpressions",
"devDependencies": {
"grunt": "~0.4.2",
"grunt-contrib-qunit": "~0.2.2",
"grunt-contrib-uglify": "~0.3.0",
"grunt-sourcemap-localize": "~0.1.0",
"grunt-contrib-copy": "~0.5.0"
},
"repository": {
"type": "git",
"url": "git://github.com/VerbalExpressions/JSVerbalExpressions.git"
},
"bugs": {
"url": "https://github.com/VerbalExpressions/JSVerbalExpressions/issues"
},
"main": "VerbalExpressions.js",
"license": {
"type": "MIT",
"url": "http://opensource.org/licenses/MIT"
},
"engines": {
"node": ">= 0.8.0"
}
}

0 comments on commit db1cb79

Please sign in to comment.