"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "packages/postcss-minify-selectors/src/__tests__/index.js" between
cssnano-cssnano-5.0.6.tar.gz and cssnano-cssnano-5.0.7.tar.gz

About: cssnano is a modular CSS minifier (built on top of the PostCSS ecosystem).

index.js  (cssnano-cssnano-5.0.6):index.js  (cssnano-cssnano-5.0.7)
skipping to change at line 483 skipping to change at line 483
function encode(str) { function encode(str) {
let result = ''; let result = '';
for (let i = 0; i < str.length; i++) { for (let i = 0; i < str.length; i++) {
result += str.charCodeAt(i).toString(16); result += str.charCodeAt(i).toString(16);
} }
return result; return result;
} }
const toModules = postcss.plugin('toModules', () => { const toModules = () => {
return (css) => { return {
css.walkRules((rule) => { postcssPlugin: 'toModules',
rule.selectors = rule.selectors.map((selector) => { Once(root) {
const slice = selector.slice(1); root.walkRules((rule) => {
rule.selectors = rule.selectors.map((selector) => {
const slice = selector.slice(1);
return `.${encode(slice).slice(0, 7)}__${slice}`; return `.${encode(slice).slice(0, 7)}__${slice}`;
});
}); });
}); },
}; };
}); };
toModules.postcss = true;
const css = `.test, /* comment #1 - this comment breaks stuff */ const css = `.test, /* comment #1 - this comment breaks stuff */
.test:hover { /* comment #2 - ...but this comment is fine */ .test:hover { /* comment #2 - ...but this comment is fine */
position: absolute; position: absolute;
} }
.ok { .ok {
padding: 4px; padding: 4px;
}`; }`;
const expected = `.7465737__test,.7465737__test:hover { /* comment #2 - ...bu t this comment is fine */ const expected = `.7465737__test,.7465737__test:hover { /* comment #2 - ...bu t this comment is fine */
 End of changes. 4 change blocks. 
8 lines changed or deleted 12 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)