New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

grunt-replacer

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-replacer - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

4

Gruntfile.js

@@ -22,7 +22,7 @@ /*

return 'with function';
}
}
}
},
files : [
{src: ['test/index.html'], dest: 'test/dist/index.html'}
{ src: ['test/index.html'], dest: 'test/dist/index.html' }
]

@@ -29,0 +29,0 @@ }

{
"name": "grunt-replacer",
"description": "Replace strings in files",
"version": "0.4.0",
"version": "0.4.1",
"homepage": "https://github.com/tomaszczechowski/grunt-replacer",

@@ -9,3 +9,3 @@ "author": {

"email": "tomasz@czechowski.pl",
"url": "http://www.czechowski.me"
"url": "http://www.czechowski.pl"
},

@@ -42,4 +42,4 @@ "repository": {

"keywords": [
"gruntplugin","replace","grunt","string"
"gruntplugin", "replace", "grunt", "string", "grunt replace string", "string replace", "replace string"
]
}

@@ -101,7 +101,8 @@ # grunt-replacer [![Build Status](https://secure.travis-ci.org/tomaszczechowski/grunt-replacer.png?branch=master)](http://travis-ci.org/tomaszczechowski/grunt-replace)

* 2013-10-20 v0.4.0 New features: colors, reportError and function as "to" param
* 2015-07-03 v0.4.1 Clean up, fixed code formatting
---
Task submitted by [Tomasz Czechowski](http://czechowski.me/)
Task submitted by [Tomasz Czechowski](http://czechowski.pl/)
*This file was generated on Fri July 19 2013 12:40:00.*
*This file was generated on Fri July 19 2013 12:40:00.*

@@ -7,3 +7,2 @@ /*

* Licensed under the MIT license.
*
*/

@@ -15,3 +14,3 @@

grunt.registerMultiTask('replacer', 'Replace code in files.', function () {
grunt.registerMultiTask('replacer', 'Replace string in files.', function () {

@@ -21,19 +20,20 @@ var options = this.options();

this.files.forEach(function(filePair) {
filePair.src.forEach(function(src) {
this.files.forEach(function (filePair) {
filePair.src.forEach(function (src) {
grunt.file.copy(src, filePair.dest, {
process: function(content) {
process: function (content) {
var from, to, regex;
for(var i in options.replace) {
from = i; to = options.replace[i];
for (var i in options.replace) {
from = i; to = options.replace[i];
to = typeof to === 'function' ? to(content) : to;
regex = new RegExp(from, 'g');
regex = new RegExp(from,'g');
if (regex.test(content)) {
content = content.replace(regex,to);
grunt.log.writeln('Replace in ' + src + ': ' + from.green + ' to: '+ to.green);
}else{
reportError('Can\'t fide "' + from.red + '" in file '+ src);
content = content.replace(regex, to);
grunt.log.writeln('Replace in ' + filePair.dest + ': ' + from.green + ' to: '+ to.green);
} else {
reportError('Can\'t find "' + from.red + '" in file ' + src);
}
}
return content;

@@ -40,0 +40,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc