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

grunt-packer

Package Overview
Dependencies
Maintainers
3
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-packer - npm Package Compare versions

Comparing version 0.3.3 to 0.3.4

test/fixture/1/css/imports/imported1.css

31

lib/pack-css-task.js

@@ -1,9 +0,16 @@

var path = require('path'),
helpers = require('./helpers.js'),
fs = require('fs'),
async = require('async'),
postcss = require('postcss');
var
path = require('path'),
helpers = require('./helpers.js'),
fs = require('fs'),
async = require('async'),
postcss = require('postcss');
var
validUrls = /url\((?!("|')?(\/|#|data:|[a-z]+:\/\/))[^)]+\)/ig,
urlPath = /url\((?:"|'|\s)?([^"'\s]+?)(?:"|'|\s)?\)/i,
importCss = /@import[^;]+;/ig,
dblSlashes = /\\/g;
function resolveUrl(root, code, cssDir) {
var matchResult = code.match(/url\((?!("|')?data:)[^#\)]+?\)/ig);
var matchResult = code.match(validUrls);

@@ -15,9 +22,9 @@ root = path.normalize(root + path.sep);

matchResult.forEach(function(match){
var parts = match.match(/url\((?:"|'|\s)?([^"'\s]+?)(?:"|'|\s)?\)/i);
var parts = match.match(urlPath);
if(parts) {
var url;
if(parts[1].charAt(0) == '/')
if(parts[1].charAt(0) == '/') {
url = parts[1];
else {
} else {
var newPath = path.resolve(cssDir, parts[1]);

@@ -29,3 +36,3 @@ url = path.relative(root, newPath);

}
code = code.replace(match, "url('" + url.replace(/\\/g, '/') + "')");
code = code.replace(match, "url('" + url.replace(dblSlashes, '/') + "')");
}

@@ -38,3 +45,3 @@ });

function bumpImportsUp(packedCss) {
var imports = packedCss.match(/@import[^;]+;/ig);
var imports = packedCss.match(importCss);
if (imports) {

@@ -158,3 +165,3 @@ imports.forEach(function(anImport){

rel: 'stylesheet',
href: '/' + path.replace(/\\/g, '/')
href: '/' + path.replace(dblSlashes, '/')
});

@@ -161,0 +168,0 @@ }

{
"name": "grunt-packer",
"description": "Grunt plugin to automagically concat JS and CSS files found in HTML",
"version": "0.3.3",
"author": "Oleg Elifantiev <oleg@elifantiev.ru>",
"version": "0.3.4",
"author": {
"name": "Oleg Elifantiev",
"email": "oleg@elifantiev.ru"
},
"contributors": [],

@@ -10,3 +13,3 @@ "main": "index.js",

"repository": {
"url": "https://github.com/Olegas/grunt-packer.git",
"url": "git+https://github.com/Olegas/grunt-packer.git",
"type": "git"

@@ -13,0 +16,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