clean-css
Advanced tools
Comparing version 3.4.10 to 3.4.11
@@ -0,1 +1,9 @@ | ||
[3.4.11 / 2016-04-01](https://github.com/jakubpawlowicz/clean-css/compare/v3.4.10...v3.4.11) | ||
================== | ||
* Fixed issue [#738](https://github.com/jakubpawlowicz/clean-css/issues/738) - edge case in comment processing. | ||
* Fixed issue [#741](https://github.com/jakubpawlowicz/clean-css/issues/741) - HTTP proxy with HTTPS inlining. | ||
* Fixed issue [#743](https://github.com/jakubpawlowicz/clean-css/issues/743) - background shorthand and source maps. | ||
* Fixed issue [#745](https://github.com/jakubpawlowicz/clean-css/issues/745) - matching mixed case `!important`. | ||
[3.4.10 / 2016-02-29](https://github.com/jakubpawlowicz/clean-css/compare/v3.4.9...v3.4.10) | ||
@@ -2,0 +10,0 @@ ================== |
@@ -271,3 +271,6 @@ var fs = require('fs'); | ||
var get = importedUrl.indexOf('http://') === 0 ? | ||
var proxyProtocol = context.inliner.request.protocol || context.inliner.request.hostname; | ||
var get = | ||
((proxyProtocol && proxyProtocol.indexOf('https://') !== 0 ) || | ||
importedUrl.indexOf('http://') === 0) ? | ||
http.get : | ||
@@ -291,5 +294,10 @@ https.get; | ||
var requestOptions = override(url.parse(importedUrl), context.inliner.request); | ||
if (context.inliner.request.hostname !== undefined) | ||
if (context.inliner.request.hostname !== undefined) { | ||
//overwrite as we always expect a http proxy currently | ||
requestOptions.protocol = context.inliner.request.protocol || 'http:'; | ||
requestOptions.path = requestOptions.href; | ||
} | ||
get(requestOptions, function (res) { | ||
@@ -296,0 +304,0 @@ if (res.statusCode < 200 || res.statusCode > 399) { |
@@ -86,3 +86,3 @@ var wrapSingle = require('./wrap-for-optimizing').single; | ||
values[i - 1] = [twoParts.pop()].concat(previousValue.slice(1)); | ||
} else if (i > 1 && values[i - 2] == '/') { | ||
} else if (i > 1 && values[i - 2][0] == '/') { | ||
size.value = [previousValue, value]; | ||
@@ -89,0 +89,0 @@ i -= 2; |
var BACKSLASH_HACK = '\\'; | ||
var IMPORTANT_TOKEN = '!important'; | ||
var IMPORTANT_WORD = 'important'; | ||
var IMPORTANT_TOKEN = '!'+IMPORTANT_WORD; | ||
var IMPORTANT_WORD_MATCH = new RegExp(IMPORTANT_WORD+'$', 'i'); | ||
var IMPORTANT_TOKEN_MATCH = new RegExp(IMPORTANT_TOKEN+'$', 'i'); | ||
var STAR_HACK = '*'; | ||
@@ -41,5 +44,5 @@ var UNDERSCORE_HACK = '_'; | ||
type = 'star'; | ||
} else if (lastValue[0][0] == BANG_HACK && lastValue[0].indexOf('important') == -1) { | ||
} else if (lastValue[0][0] == BANG_HACK && !lastValue[0].match(IMPORTANT_WORD_MATCH)) { | ||
type = 'bang'; | ||
} else if (lastValue[0].indexOf(BANG_HACK) > 0 && lastValue[0].indexOf('important') == -1) { | ||
} else if (lastValue[0].indexOf(BANG_HACK) > 0 && !lastValue[0].match(IMPORTANT_WORD_MATCH)) { | ||
type = 'bang'; | ||
@@ -56,5 +59,9 @@ } else if (lastValue[0].indexOf(BACKSLASH_HACK) > 0 && lastValue[0].indexOf(BACKSLASH_HACK) == lastValue[0].length - BACKSLASH_HACK.length - 1) { | ||
function isImportant(property) { | ||
return property.length > 1 ? | ||
property[property.length - 1][0].indexOf(IMPORTANT_TOKEN) > 0 : | ||
false; | ||
if (property.length > 1) { | ||
var p = property[property.length - 1][0]; | ||
if (typeof(p) === 'string') { | ||
return IMPORTANT_TOKEN_MATCH.test(p); | ||
} | ||
} | ||
return false; | ||
} | ||
@@ -64,3 +71,3 @@ | ||
if (property.length > 0) | ||
property[property.length - 1][0] = property[property.length - 1][0].replace(IMPORTANT_TOKEN, ''); | ||
property[property.length - 1][0] = property[property.length - 1][0].replace(IMPORTANT_TOKEN_MATCH, ''); | ||
} | ||
@@ -67,0 +74,0 @@ |
@@ -8,2 +8,7 @@ var split = require('../utils/split'); | ||
var IMPORTANT_WORD = 'important'; | ||
var IMPORTANT_TOKEN = '!'+IMPORTANT_WORD; | ||
var IMPORTANT_WORD_MATCH = new RegExp('^'+IMPORTANT_WORD+'$', 'i'); | ||
var IMPORTANT_TOKEN_MATCH = new RegExp('^'+IMPORTANT_TOKEN+'$', 'i'); | ||
function selectorName(value) { | ||
@@ -157,5 +162,5 @@ return value[0]; | ||
var pos = body.length - 1; | ||
if (trimmed == 'important' && body[pos][0] == '!') { | ||
if (IMPORTANT_WORD_MATCH.test(trimmed) && body[pos][0] == '!') { | ||
context.track(trimmed); | ||
body[pos - 1][0] += '!important'; | ||
body[pos - 1][0] += IMPORTANT_TOKEN; | ||
body.pop(); | ||
@@ -165,3 +170,3 @@ continue; | ||
if (trimmed == '!important' || (trimmed == 'important' && body[pos][0][body[pos][0].length - 1] == '!')) { | ||
if (IMPORTANT_TOKEN_MATCH.test(trimmed) || (IMPORTANT_WORD_MATCH.test(trimmed) && body[pos][0][body[pos][0].length - 1] == '!')) { | ||
context.track(trimmed); | ||
@@ -168,0 +173,0 @@ body[pos][0] += trimmed; |
@@ -0,1 +1,3 @@ | ||
var COMMENT_START_MARK = '/*'; | ||
function QuoteScanner(data) { | ||
@@ -6,3 +8,2 @@ this.data = data; | ||
var findQuoteEnd = function (data, matched, cursor, oldCursor) { | ||
var commentStartMark = '/*'; | ||
var commentEndMark = '*/'; | ||
@@ -13,3 +14,3 @@ var escapeMark = '\\'; | ||
var commentEndedAt = dataPrefix.lastIndexOf(commentEndMark, cursor); | ||
var commentStartedAt = dataPrefix.lastIndexOf(commentStartMark, cursor); | ||
var commentStartedAt = findLastCommentStartedAt(dataPrefix, cursor); | ||
var commentStarted = false; | ||
@@ -43,2 +44,18 @@ | ||
function findLastCommentStartedAt(data, cursor) { | ||
var position = cursor; | ||
while (position > -1) { | ||
position = data.lastIndexOf(COMMENT_START_MARK, position); | ||
if (position > -1 && data[position - 1] != '*') { | ||
break; | ||
} else { | ||
position--; | ||
} | ||
} | ||
return position; | ||
} | ||
function findNext(data, mark, startAt) { | ||
@@ -45,0 +62,0 @@ var escapeMark = '\\'; |
{ | ||
"name": "clean-css", | ||
"version": "3.4.10", | ||
"version": "3.4.11", | ||
"author": "Jakub Pawlowicz <contact@jakubpawlowicz.com> (http://twitter.com/jakubpawlowicz)", | ||
@@ -5,0 +5,0 @@ "description": "A well-tested CSS minifier", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
301493
5842