* Fixed issue [#959](https://github.com/jakubpawlowicz/clean-css/issues/959) - regression in shortening long hex values.
* Fixed issue [#960](https://github.com/jakubpawlowicz/clean-css/issues/960) - better explanation of `efficiency` stat.
* Fixed issue [#965](https://github.com/jakubpawlowicz/clean-css/issues/965) - edge case in parsing comment endings.
+* Fixed issue [#966](https://github.com/jakubpawlowicz/clean-css/issues/966) - remote `@import`s referenced from local ones.
[4.1.7 / 2017-07-14](https://github.com/jakubpawlowicz/clean-css/compare/v4.1.6...v4.1.7)
==================
path.resolve(inlinerContext.rebaseTo, uri);
var relativeToCurrentPath = path.relative(currentPath, absoluteUri);
var importedStyles;
- var importedTokens;
var isAllowed = isAllowedResource(uri, false, inlinerContext.inline);
var normalizedPath = normalizePath(relativeToCurrentPath);
var isLoaded = normalizedPath in inlinerContext.externalContext.sourcesContent;
inlinerContext.externalContext.sourcesContent[normalizedPath] = importedStyles;
inlinerContext.externalContext.stats.originalSize += importedStyles.length;
- importedTokens = fromStyles(importedStyles, inlinerContext.externalContext, inlinerContext, function (tokens) { return tokens; });
- importedTokens = wrapInMedia(importedTokens, mediaQuery, metadata);
+ return fromStyles(importedStyles, inlinerContext.externalContext, inlinerContext, function (importedTokens) {
+ importedTokens = wrapInMedia(importedTokens, mediaQuery, metadata);
- inlinerContext.outputTokens = inlinerContext.outputTokens.concat(importedTokens);
+ inlinerContext.outputTokens = inlinerContext.outputTokens.concat(importedTokens);
+ inlinerContext.sourceTokens = inlinerContext.sourceTokens.slice(1);
+
+ return doInlineImports(inlinerContext);
+ });
}
inlinerContext.sourceTokens = inlinerContext.sourceTokens.slice(1);
nock.cleanAll();
}
},
+ 'of a remote resource referenced from local one given via hash': {
+ topic: function () {
+ this.reqMocks = nock('http://127.0.0.1')
+ .get('/remote.css')
+ .reply(200, 'div{padding:0}');
+
+ new CleanCSS({ inline: 'all' }).minify({ 'local.css': { styles: '@import url(http://127.0.0.1/remote.css);' } }, this.callback);
+ },
+ 'should not raise errors': function (errors, minified) {
+ assert.isNull(errors);
+ },
+ 'should process @import': function (errors, minified) {
+ assert.equal(minified.styles, 'div{padding:0}');
+ },
+ 'hits the endpoint': function () {
+ assert.isTrue(this.reqMocks.isDone());
+ },
+ teardown: function () {
+ nock.cleanAll();
+ }
+ },
'of a remote resource after content and no callback': {
topic: function () {
var source = '.one{color:red}@import url(http://127.0.0.1/remote.css);';