Skip to content
Browse files

Replace task example.

  • Loading branch information...
1 parent fc08138 commit 6e1c2c74b70d728b07084d7b3f63d6df55840314 @yuanyan yuanyan committed Jan 1, 2014
Showing with 34 additions and 0 deletions.
  1. +28 −0 example/replace/Modfile.js
  2. +3 −0 example/replace/foo.js
  3. +3 −0 example/replace/foo.replaced.js
View
28 example/replace/Modfile.js
@@ -0,0 +1,28 @@
+module.exports = {
+ tasks: {
+ replace: {
+ string: {
+ src: "foo.js",
+ dest: "foo.replaced.js",
+ search: "TIMESTAMP",
+ replace: +new Date
+ },
+ regexp: {
+ src: "foo.replaced.js",
+ search: /DEBUG/g,
+ replace: true
+ },
+ func: {
+ src: "foo.replaced.js",
+ search: /v(\d+)/,
+ replace: function(match, v){
+ var v = Number(v);
+ return 'v' + ++v
+ }
+ }
+ }
+ },
+ targets: {
+ default: "replace"
+ }
+};
View
3 example/replace/foo.js
@@ -0,0 +1,3 @@
+var ts = TIMESTAMP;
+var debug = DEBUG;
+var ver = "v1";
View
3 example/replace/foo.replaced.js
@@ -0,0 +1,3 @@
+var ts = 1388510983879;
+var debug = true;
+var ver = "v2";

0 comments on commit 6e1c2c7

Please sign in to comment.
Something went wrong with that request. Please try again.