grunt-regex-replace
Advanced tools
+41
| module.exports = function(grunt) { | ||
| 'use strict'; | ||
| // Project configuration. | ||
| grunt.initConfig({ | ||
| watch: { | ||
| files: '<%= jshint.all %>', | ||
| tasks: 'default' | ||
| }, | ||
| jshint: { | ||
| options: { | ||
| curly: true, | ||
| eqeqeq: true, | ||
| immed: true, | ||
| latedef: true, | ||
| newcap: true, | ||
| noarg: true, | ||
| sub: true, | ||
| undef: true, | ||
| boss: true, | ||
| eqnull: true, | ||
| node: true, | ||
| es5: true, | ||
| expr: true | ||
| }, | ||
| all: ['Gruntfile.js', 'tasks/**/*.js', 'test/**/*.js'] | ||
| }, | ||
| nodeunit: { | ||
| all: ['test/**/*.js'] | ||
| } | ||
| }); | ||
| //Load dependency tasks | ||
| grunt.loadNpmTasks('grunt-contrib-jshint'); | ||
| grunt.loadNpmTasks('grunt-contrib-nodeunit'); | ||
| grunt.loadNpmTasks('grunt-contrib-watch'); | ||
| // Load local tasks. | ||
| grunt.loadTasks('tasks'); | ||
| // Default task. | ||
| grunt.registerTask('default', ['jshint', 'nodeunit']); | ||
| }; |
+7
-4
| { | ||
| "name": "grunt-regex-replace", | ||
| "description": "Grunt plugin to search and replace text content of files based on regular expression patterns", | ||
| "version": "0.1.2", | ||
| "version": "0.2.1", | ||
| "homepage": "https://github.com/bomsy/grunt-regex-replace", | ||
@@ -23,3 +23,3 @@ "author": { | ||
| ], | ||
| "main": "grunt.js", | ||
| "main": "Gruntfile.js", | ||
| "bin": "bin/grunt-regex-replace", | ||
@@ -33,3 +33,6 @@ "engines": { | ||
| "devDependencies": { | ||
| "grunt": "~0.3.17" | ||
| "grunt": "0.4.x", | ||
| "grunt-contrib-jshint": "~0.4.3", | ||
| "grunt-contrib-nodeunit": "~0.1.2", | ||
| "grunt-contrib-watch": "~0.3.1" | ||
| }, | ||
@@ -42,2 +45,2 @@ "keywords": [ | ||
| ] | ||
| } | ||
| } |
+2
-0
@@ -68,2 +68,4 @@ # grunt-regex-replace | ||
| v0.2.1 - Updated to support grunt 0.4.x | ||
| ## License | ||
@@ -70,0 +72,0 @@ Copyright (c) 2012 Hubert Boma Manilla |
@@ -7,6 +7,7 @@ /* | ||
| * Licensed under the MIT license. | ||
| * | ||
| */ | ||
| module.exports = function(grunt) { | ||
| 'use strict' | ||
| "use strict"; | ||
| // Please see the grunt documentation for more information regarding task and | ||
@@ -18,3 +19,2 @@ // helper creation: https://github.com/gruntjs/grunt/blob/master/docs/toc.md | ||
| // ========================================================================== | ||
| ; | ||
| grunt.registerMultiTask('regex-replace', 'find & replace content of a file based regex patterns', function(){ | ||
@@ -39,3 +39,3 @@ var files = grunt.file.expandFiles(this.file.src), | ||
| } | ||
| updatedContent = grunt.helper('regex-replace', updatedContent, grunt.template.process(actions[j].search), grunt.template.process(actions[j].replace), options, j); | ||
| updatedContent = regexReplace( updatedContent, grunt.template.process(actions[j].search), grunt.template.process(actions[j].replace), options, j); | ||
| } | ||
@@ -54,3 +54,3 @@ grunt.file.write(files[i], updatedContent); | ||
| grunt.registerHelper('regex-replace', function(src, regex, substr, options, index){ | ||
| var regexReplace = function(src, regex, substr, options, index){ | ||
| //takes the sr content and changes the | ||
@@ -63,4 +63,4 @@ var regExp = new RegExp(regex , options), | ||
| return updatedSrc; | ||
| }); | ||
| }; | ||
| }; |
| var grunt = require('grunt'); | ||
| "use strict"; | ||
| /* | ||
@@ -29,7 +29,6 @@ ======== A Handy Little Nodeunit Reference ======== | ||
| 'helper': function(test) { | ||
| test.expect(1); | ||
| // tests here | ||
| test.equal(grunt.helper('regex-replace'), 'regex-replace!!!', 'should return the correct value.'); | ||
| test.ok(true); | ||
| test.done(); | ||
| } | ||
| }; |
-40
| module.exports = function(grunt) { | ||
| // Project configuration. | ||
| grunt.initConfig({ | ||
| test: { | ||
| files: ['test/**/*.js'] | ||
| }, | ||
| lint: { | ||
| files: ['grunt.js', 'tasks/**/*.js', 'test/**/*.js'] | ||
| }, | ||
| watch: { | ||
| files: '<config:lint.files>', | ||
| tasks: 'default' | ||
| }, | ||
| jshint: { | ||
| options: { | ||
| curly: true, | ||
| eqeqeq: true, | ||
| immed: true, | ||
| latedef: true, | ||
| newcap: true, | ||
| noarg: true, | ||
| sub: true, | ||
| undef: true, | ||
| boss: true, | ||
| eqnull: true, | ||
| node: true, | ||
| es5: true | ||
| }, | ||
| globals: {} | ||
| } | ||
| }); | ||
| // Load local tasks. | ||
| grunt.loadTasks('tasks'); | ||
| // Default task. | ||
| grunt.registerTask('default', 'lint test'); | ||
| }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
127
2.42%73
2.82%8738
-0.25%4
300%