Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-css-rebase

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-css-rebase - npm Package Compare versions

Comparing version 2.0.2 to 2.0.3

.travis.yml

86

index.js

@@ -14,42 +14,42 @@ 'use strict';

module.exports = function (opt) {
var options = merge({
output_assets: null,
output_css: null,
exclude: [],
overwrite: false
}, opt);
var options = merge({
output_assets: null,
output_css: null,
exclude: [],
overwrite: false
}, opt);
return through.obj(function (file, enc, cb) {
if (file.isNull()) {
return;
}
return through.obj(function (file, enc, cb) {
if (file.isNull()) {
return;
}
if (file.isStream()) {
return this.emit('error', PluginError('gulp-css-rebase', 'Streaming not supported'));
}
if (file.isStream()) {
return this.emit('error', PluginError('gulp-css-rebase', 'Streaming not supported')); // eslint-disable-line
}
var adjusted = adjust(file);
file.contents = new Buffer(adjusted);
var adjusted = adjust(file);
file.contents = new Buffer(adjusted);
cb(null, file);
});
cb(null, file);
});
function adjust(file) {
var css = file.contents.toString();
function adjust(file) {
var css = file.contents.toString();
return rework(css)
return rework(css)
.use(url(function (url) {
if (!/^(data|\/|\w+:\/\/)/.test(url)) {
var assetPath = path.join(path.dirname(file.path), url);
var assetFolder = md5(path.relative(process.cwd(), path.dirname(assetPath)));
var IsExclude = false;
if (!/^(data|\/|\w+:\/\/)/.test(url)) {
var assetPath = path.join(path.dirname(file.path), url);
var assetFolder = md5(path.relative(process.cwd(), path.dirname(assetPath)));
var IsExclude = false;
for (var index in options.exclude) {
if (options.exclude[index] === assetPath.substr(0, options.exclude[index].length)) {
IsExclude = true;
break;
}
}
for (var index in options.exclude) {
if (options.exclude[index] === assetPath.substr(0, options.exclude[index].length)) {
IsExclude = true;
break;
}
}
var newPath = !IsExclude
var newPath = !IsExclude
? path.normalize(path.join(options.output_assets, assetFolder, path.basename(assetPath)))

@@ -59,3 +59,3 @@ : path.normalize(assetPath)

if (
if (
(!IsExclude && !fileExists(newPath))

@@ -65,22 +65,22 @@ ||

) {
mkpath(path.dirname(newPath), function (err) {
if (err) {
throw err;
}
mkpath(path.dirname(newPath), function (err) {
if (err) {
throw err;
}
fs
fs
.createReadStream(assetPath.replace(/[\#|\?].*$/, ''))
.pipe(fs.createWriteStream(newPath.replace(/[\#|\?].*$/, '')))
;
});
});
}
url = path.relative(options.output_css, newPath);
}
return url;
url = path.relative(options.output_css, newPath);
}
return url;
}))
.toString();
}
}
};
{
"name": "gulp-css-rebase",
"version": "2.0.2",
"version": "2.0.3",
"description": "Rewrite url references in CSS and copyed CSS assets",

@@ -17,5 +17,10 @@ "main": "index.js",

},
"devDependencies": {},
"devDependencies": {
"eslint": "^3.19.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "node_modules/.bin/eslint .",
"patch": "npm version patch && git push origin master --follow-tags && npm publish",
"minor": "npm version minor && git push origin master --follow-tags && npm publish",
"major": "npm version major && git push origin master --follow-tags && npm publish"
},

@@ -27,3 +32,3 @@ "repository": {

"author": "Igor Ognichenko <ognichenko.igor@gmail.com>",
"license": "ISC",
"license": "MIT",
"bugs": {

@@ -30,0 +35,0 @@ "url": "https://github.com/RobinCK/gulp-css-rebase/issues"

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