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

grunt-appolo-assets-url-replace

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-appolo-assets-url-replace - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

package.json~

3

Gruntfile.js

@@ -50,3 +50,3 @@ /*

tests: ['test/*_test.js'],
},
}

@@ -69,3 +69,2 @@ });

grunt.registerTask('default', ['jshint', 'test']);
};
{
"name": "grunt-appolo-assets-url-replace",
"description": "Grunt task to replace assets urls with absolute path",
"version": "0.0.1",
"version": "0.0.2",
"author": {

@@ -19,13 +19,5 @@ "name": "Roman Svichar",

"type": "git",
"url": "git://github.com/nanjingboy/grunt-css-url-replace.git"
"url": "https://github.com/shmoop207/grunt-appolo-assets-url-replace.git"
},
"bugs": {
"url": "https://github.com/nanjingboy/grunt-css-url-replace/issues"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/nanjingboy/grunt-css-url-replace/blob/master/LICENSE-MIT"
}
],
"main": "Gruntfile.js",

@@ -32,0 +24,0 @@ "engines": {

@@ -12,3 +12,3 @@

var cssRegex = /url\s?\(['"]?(.*)(?=['"]?\))/gi;
var cssRegex = /url\s*\(\s*(['"]?)([^"'\)]*)\1\s*\)/gi;
var htmlRegex = /src\s?\=['"]?(.*)['"]/gi;

@@ -34,2 +34,3 @@

var modified = false;
var css = fs.readFileSync(filepath).toString(),

@@ -44,10 +45,14 @@ match;

css = css.replace(match[0], "url("+options.staticUrl + path.normalize('/'+ imagePath)+")");
modified = true;
}
}
grunt.file.write(filepath, css);
grunt.log.writeln('File "' + filepath + '" modified.');
if(modified) {
grunt.file.write(filepath, css);
grunt.log.writeln('File "' + filepath + '" modified.');
}
} else if(ext == '.html' || ext == '.htm') {
var modified = false;
var html = fs.readFileSync(filepath).toString(),

@@ -59,11 +64,12 @@ match;

console.log(match[0]);
if (imagePath.indexOf("http://") == -1 && imagePath.indexOf(";base64") == -1 && options.ext.indexOf(path.extname(imagePath)) > -1 ) {
html = html.replace(match[0], 'src="'+options.staticUrl + path.normalize('/'+ imagePath)+'"');
modified = true;
}
}
grunt.file.write(filepath, html);
grunt.log.writeln('File "' + filepath + '" modified.');
if(modified) {
grunt.file.write(filepath, html);
grunt.log.writeln('File "' + filepath + '" modified.');
}
}

@@ -70,0 +76,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