Skip to content

Commit

Permalink
[icons] Remove extraneous path (mui#19483)
Browse files Browse the repository at this point in the history
  • Loading branch information
timmydoza authored and EsoterikStare committed Feb 13, 2020
1 parent cf3fcd3 commit 5b6f957
Show file tree
Hide file tree
Showing 305 changed files with 288 additions and 569 deletions.
49 changes: 34 additions & 15 deletions packages/material-ui-icons/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import rimraf from 'rimraf';
import Mustache from 'mustache';
import Queue from 'modules/waterfall/Queue';
import util from 'util';
import intersection from 'lodash/intersection';
import glob from 'glob';
import SVGO from 'svgo';

Expand Down Expand Up @@ -39,7 +40,12 @@ const svgo = new SVGO({
{ convertTransform: true },
{ removeUnknownsAndDefaults: true },
{ removeNonInheritableGroupAttrs: true },
{ removeUselessStrokeAndFill: true },
{
removeUselessStrokeAndFill: {
// https://github.com/svg/svgo/issues/727#issuecomment-303115276
removeNone: true,
},
},
{ removeUnusedNS: true },
{ cleanupIDs: true },
{ cleanupNumericValues: true },
Expand Down Expand Up @@ -90,19 +96,26 @@ async function generateIndex(options) {

// Noise introduced by Google by mistake
const noises = [
['<g fill="none"><path d="M0 0h24v24H0z" /><path d="M0 0h24v24H0z" /></g>', ''],
[
'<g fill="none"><path d="M0 0h24v24H0z" /><path d="M0 0h24v24H0z" /><path d="M0 0h24v24H0z" /></g>',
'',
],
['<path fill="none" d="M0 0h24v24H0V0zm0 0h24v24H0V0zm0 0h24v24H0V0zm0 0h24v24H0V0z" />', ''],
['<path fill="none" d="M0 0h24v24H0V0zm0 0h24v24H0V0z" />', ''],
['<path fill="none" d="M0 0h24v24H0V0z" />', ''],
['<path fill="none" d="M0 0h24v24H0z" />', ''],
['="M0 0h24v24H0V0zm0 0h24v24H0V0z', '="'],
['="M0 0h24v24H0zm0 0h24v24H0zm0 0h24v24H0z', '="'],
];

function removeNoise(input, prevInput = null) {
if (input === prevInput) {
return input;
}

let output = input;

noises.forEach(([search, replace]) => {
if (output.indexOf(search) !== -1) {
output = output.replace(search, replace);
}
});

return removeNoise(output, input);
}

export async function cleanPaths({ svgPath, data }) {
// Remove hardcoded color fill before optimizing so that empty groups are removed
const input = data
Expand Down Expand Up @@ -134,11 +147,7 @@ export async function cleanPaths({ svgPath, data }) {
paths = paths.replace(/<path /g, `<path transform="scale(${scale}, ${scale})" `);
}

noises.forEach(([search, replace]) => {
if (paths.indexOf(search) !== -1) {
paths = paths.replace(search, replace);
}
});
paths = removeNoise(paths);

// Add a fragment when necessary.
if ((paths.match(/\/>/g) || []).length > 1) {
Expand Down Expand Up @@ -230,6 +239,16 @@ export async function main(options) {
queue.push(svgPaths);
await queue.wait({ empty: true });

let legacyFiles = await globAsync(path.join(__dirname, '/legacy', '*.js'));
legacyFiles = legacyFiles.map(file => path.basename(file));
let generatedFiles = await globAsync(path.join(options.outputDir, '*.js'));
generatedFiles = generatedFiles.map(file => path.basename(file));

if (intersection(legacyFiles, generatedFiles).length > 0) {
console.warn(intersection(legacyFiles, generatedFiles));
throw new Error('Duplicated icons in legacy folder');
}

await fse.copy(path.join(__dirname, '/legacy'), options.outputDir);
await fse.copy(path.join(__dirname, '/custom'), options.outputDir);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import React from 'react';
import createSvgIcon from './utils/createSvgIcon';

export default createSvgIcon(
<React.Fragment><path fill="none" d="M-618-568H782v3600H-618zM0 0h24v24H0z" /><path d="M22 5.7l-4.6-3.9-1.3 1.5 4.6 3.9L22 5.7zM7.9 3.4L6.6 1.9 2 5.7l1.3 1.5 4.6-3.8zM12.5 8H11v6l4.7 2.9.8-1.2-4-2.4V8zM12 4c-5 0-9 4-9 9s4 9 9 9 9-4 9-9-4-9-9-9zm0 16c-3.9 0-7-3.1-7-7s3.1-7 7-7 7 3.1 7 7-3.1 7-7 7z" /></React.Fragment>
<path d="M22 5.7l-4.6-3.9-1.3 1.5 4.6 3.9L22 5.7zM7.9 3.4L6.6 1.9 2 5.7l1.3 1.5 4.6-3.8zM12.5 8H11v6l4.7 2.9.8-1.2-4-2.4V8zM12 4c-5 0-9 4-9 9s4 9 9 9 9-4 9-9-4-9-9-9zm0 16c-3.9 0-7-3.1-7-7s3.1-7 7-7 7 3.1 7 7-3.1 7-7 7z" />
, 'AccessAlarms');
6 changes: 0 additions & 6 deletions packages/material-ui-icons/legacy/AddLocation.js

This file was deleted.

6 changes: 0 additions & 6 deletions packages/material-ui-icons/legacy/AddLocationOutlined.js

This file was deleted.

6 changes: 0 additions & 6 deletions packages/material-ui-icons/legacy/AddLocationRounded.js

This file was deleted.

6 changes: 0 additions & 6 deletions packages/material-ui-icons/legacy/AddLocationSharp.js

This file was deleted.

6 changes: 0 additions & 6 deletions packages/material-ui-icons/legacy/AddLocationTwoTone.js

This file was deleted.

6 changes: 0 additions & 6 deletions packages/material-ui-icons/legacy/AlternateEmail.js

This file was deleted.

6 changes: 0 additions & 6 deletions packages/material-ui-icons/legacy/AlternateEmailOutlined.js

This file was deleted.

6 changes: 0 additions & 6 deletions packages/material-ui-icons/legacy/AlternateEmailRounded.js

This file was deleted.

6 changes: 0 additions & 6 deletions packages/material-ui-icons/legacy/AlternateEmailSharp.js

This file was deleted.

6 changes: 0 additions & 6 deletions packages/material-ui-icons/legacy/AlternateEmailTwoTone.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/material-ui-icons/legacy/BatteryCharging50.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import React from 'react';
import createSvgIcon from './utils/createSvgIcon';

export default createSvgIcon(
<React.Fragment><path fill="none" d="M0 0h24v24H0zm9 14.5h2V20l3.47-6.5H9.53zm4-2V7l-2.93 5.5-.54 1h4.94l.53-1z" /><path d="M14.47 13.5L11 20v-5.5H9l.53-1H7v7.17C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V13.5h-2.53z" /><path fillOpacity=".3" d="M15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33v8.17h2.53L13 7v5.5h2l-.53 1H17V5.33C17 4.6 16.4 4 15.67 4z" /></React.Fragment>
<React.Fragment><path d="M14.47 13.5L11 20v-5.5H9l.53-1H7v7.17C7 21.4 7.6 22 8.33 22h7.33c.74 0 1.34-.6 1.34-1.33V13.5h-2.53z" /><path fillOpacity=".3" d="M15.67 4H14V2h-4v2H8.33C7.6 4 7 4.6 7 5.33v8.17h2.53L13 7v5.5h2l-.53 1H17V5.33C17 4.6 16.4 4 15.67 4z" /></React.Fragment>
, 'BatteryCharging50');
2 changes: 1 addition & 1 deletion packages/material-ui-icons/legacy/CastForEducation.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import React from 'react';
import createSvgIcon from './utils/createSvgIcon';

export default createSvgIcon(
<React.Fragment><path transform="scale(0.5, 0.5)" d="M42 6H6c-2.2 0-4 1.8-4 4v6h4v-6h36v28H28v4h14c2.2 0 4-1.8 4-4V10c0-2.2-1.8-4-4-4zM2 36v6h6c0-3.32-2.68-6-6-6zm0-8v4c5.52 0 10 4.48 10 10h4c0-7.74-6.26-14-14-14zm0-8v4c9.94 0 18 8.06 18 18h4c0-12.16-9.86-22-22-22zm20 2.18v4L29 30l7-3.82v-4L29 26l-7-3.82zM29 12l-11 6 11 6 11-6-11-6z" /><path transform="scale(0.5, 0.5)" fill="none" d="M0 0h48v48H0z" /></React.Fragment>
<path transform="scale(0.5, 0.5)" d="M42 6H6c-2.2 0-4 1.8-4 4v6h4v-6h36v28H28v4h14c2.2 0 4-1.8 4-4V10c0-2.2-1.8-4-4-4zM2 36v6h6c0-3.32-2.68-6-6-6zm0-8v4c5.52 0 10 4.48 10 10h4c0-7.74-6.26-14-14-14zm0-8v4c9.94 0 18 8.06 18 18h4c0-12.16-9.86-22-22-22zm20 2.18v4L29 30l7-3.82v-4L29 26l-7-3.82zM29 12l-11 6 11 6 11-6-11-6z" />
, 'CastForEducation');
6 changes: 0 additions & 6 deletions packages/material-ui-icons/legacy/Domain.js

This file was deleted.

6 changes: 0 additions & 6 deletions packages/material-ui-icons/legacy/DomainOutlined.js

This file was deleted.

6 changes: 0 additions & 6 deletions packages/material-ui-icons/legacy/DomainRounded.js

This file was deleted.

6 changes: 0 additions & 6 deletions packages/material-ui-icons/legacy/DomainSharp.js

This file was deleted.

6 changes: 0 additions & 6 deletions packages/material-ui-icons/legacy/DomainTwoTone.js

This file was deleted.

6 changes: 0 additions & 6 deletions packages/material-ui-icons/legacy/EditLocation.js

This file was deleted.

6 changes: 0 additions & 6 deletions packages/material-ui-icons/legacy/EditLocationOutlined.js

This file was deleted.

6 changes: 0 additions & 6 deletions packages/material-ui-icons/legacy/EditLocationRounded.js

This file was deleted.

6 changes: 0 additions & 6 deletions packages/material-ui-icons/legacy/EditLocationSharp.js

This file was deleted.

6 changes: 0 additions & 6 deletions packages/material-ui-icons/legacy/EditLocationTwoTone.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/material-ui-icons/legacy/LocationOff.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import React from 'react';
import createSvgIcon from './utils/createSvgIcon';

export default createSvgIcon(
<React.Fragment><path fill="none" d="M0 0h24v24H0zm11.75 11.47l-.11-.11z" /><path d="M12 6.5c1.38 0 2.5 1.12 2.5 2.5 0 .74-.33 1.39-.83 1.85l3.63 3.63c.98-1.86 1.7-3.8 1.7-5.48 0-3.87-3.13-7-7-7-1.98 0-3.76.83-5.04 2.15l3.19 3.19c.46-.52 1.11-.84 1.85-.84zm4.37 9.6l-4.63-4.63-.11-.11L3.27 3 2 4.27l3.18 3.18C5.07 7.95 5 8.47 5 9c0 5.25 7 13 7 13s1.67-1.85 3.38-4.35L18.73 21 20 19.73l-3.63-3.63z" /></React.Fragment>
<path d="M12 6.5c1.38 0 2.5 1.12 2.5 2.5 0 .74-.33 1.39-.83 1.85l3.63 3.63c.98-1.86 1.7-3.8 1.7-5.48 0-3.87-3.13-7-7-7-1.98 0-3.76.83-5.04 2.15l3.19 3.19c.46-.52 1.11-.84 1.85-.84zm4.37 9.6l-4.63-4.63-.11-.11L3.27 3 2 4.27l3.18 3.18C5.07 7.95 5 8.47 5 9c0 5.25 7 13 7 13s1.67-1.85 3.38-4.35L18.73 21 20 19.73l-3.63-3.63z" />
, 'LocationOff');
2 changes: 1 addition & 1 deletion packages/material-ui-icons/legacy/LocationOffOutlined.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import React from 'react';
import createSvgIcon from './utils/createSvgIcon';

export default createSvgIcon(
<React.Fragment><path d="M12 4c2.76 0 5 2.24 5 5 0 1.06-.39 2.32-1 3.62l1.49 1.49C18.37 12.36 19 10.57 19 9c0-3.87-3.13-7-7-7-1.84 0-3.5.71-4.75 1.86l1.43 1.43C9.56 4.5 10.72 4 12 4zm0 2.5c-.59 0-1.13.21-1.56.56l3.5 3.5c.35-.43.56-.97.56-1.56 0-1.38-1.12-2.5-2.5-2.5zM3.41 2.86L2 4.27l3.18 3.18C5.07 7.95 5 8.47 5 9c0 5.25 7 13 7 13s1.67-1.85 3.38-4.35L18.73 21l1.41-1.41L3.41 2.86zM12 18.88c-2.01-2.58-4.8-6.74-4.98-9.59l6.92 6.92c-.65.98-1.33 1.89-1.94 2.67z" /></React.Fragment>
<path d="M12 4c2.76 0 5 2.24 5 5 0 1.06-.39 2.32-1 3.62l1.49 1.49C18.37 12.36 19 10.57 19 9c0-3.87-3.13-7-7-7-1.84 0-3.5.71-4.75 1.86l1.43 1.43C9.56 4.5 10.72 4 12 4zm0 2.5c-.59 0-1.13.21-1.56.56l3.5 3.5c.35-.43.56-.97.56-1.56 0-1.38-1.12-2.5-2.5-2.5zM3.41 2.86L2 4.27l3.18 3.18C5.07 7.95 5 8.47 5 9c0 5.25 7 13 7 13s1.67-1.85 3.38-4.35L18.73 21l1.41-1.41L3.41 2.86zM12 18.88c-2.01-2.58-4.8-6.74-4.98-9.59l6.92 6.92c-.65.98-1.33 1.89-1.94 2.67z" />
, 'LocationOffOutlined');
2 changes: 1 addition & 1 deletion packages/material-ui-icons/legacy/LocationOffRounded.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import React from 'react';
import createSvgIcon from './utils/createSvgIcon';

export default createSvgIcon(
<React.Fragment><path d="M2.71 3.56c-.39.39-.39 1.02 0 1.41l2.47 2.47C5.07 7.95 5 8.47 5 9c0 4.17 4.42 9.92 6.23 12.11.4.48 1.13.48 1.53 0 .65-.78 1.62-2.01 2.61-3.46l2.65 2.65c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L4.12 3.56a.9959.9959 0 0 0-1.41 0zM12 2c-1.84 0-3.5.71-4.75 1.86l3.19 3.19c.43-.34.97-.55 1.56-.55 1.38 0 2.5 1.12 2.5 2.5 0 .59-.21 1.13-.56 1.56l3.55 3.55C18.37 12.36 19 10.57 19 9c0-3.87-3.13-7-7-7z" /></React.Fragment>
<path d="M2.71 3.56c-.39.39-.39 1.02 0 1.41l2.47 2.47C5.07 7.95 5 8.47 5 9c0 4.17 4.42 9.92 6.23 12.11.4.48 1.13.48 1.53 0 .65-.78 1.62-2.01 2.61-3.46l2.65 2.65c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L4.12 3.56a.9959.9959 0 0 0-1.41 0zM12 2c-1.84 0-3.5.71-4.75 1.86l3.19 3.19c.43-.34.97-.55 1.56-.55 1.38 0 2.5 1.12 2.5 2.5 0 .59-.21 1.13-.56 1.56l3.55 3.55C18.37 12.36 19 10.57 19 9c0-3.87-3.13-7-7-7z" />
, 'LocationOffRounded');
2 changes: 1 addition & 1 deletion packages/material-ui-icons/legacy/LocationOffSharp.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import React from 'react';
import createSvgIcon from './utils/createSvgIcon';

export default createSvgIcon(
<React.Fragment><path d="M3.41 2.86L2 4.27l3.18 3.18C5.07 7.95 5 8.47 5 9c0 5.25 7 13 7 13s1.67-1.85 3.38-4.35L18.73 21l1.41-1.41L3.41 2.86zM12 2c-1.84 0-3.5.71-4.75 1.86l3.19 3.19c.43-.34.97-.55 1.56-.55 1.38 0 2.5 1.12 2.5 2.5 0 .59-.21 1.13-.56 1.56l3.55 3.55C18.37 12.36 19 10.57 19 9c0-3.87-3.13-7-7-7z" /></React.Fragment>
<path d="M3.41 2.86L2 4.27l3.18 3.18C5.07 7.95 5 8.47 5 9c0 5.25 7 13 7 13s1.67-1.85 3.38-4.35L18.73 21l1.41-1.41L3.41 2.86zM12 2c-1.84 0-3.5.71-4.75 1.86l3.19 3.19c.43-.34.97-.55 1.56-.55 1.38 0 2.5 1.12 2.5 2.5 0 .59-.21 1.13-.56 1.56l3.55 3.55C18.37 12.36 19 10.57 19 9c0-3.87-3.13-7-7-7z" />
, 'LocationOffSharp');
2 changes: 1 addition & 1 deletion packages/material-ui-icons/legacy/LocationOffTwoTone.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import React from 'react';
import createSvgIcon from './utils/createSvgIcon';

export default createSvgIcon(
<React.Fragment><path d="M17 9c0 1.06-.39 2.32-1 3.62l1.49 1.49C18.37 12.36 19 10.57 19 9c0-3.87-3.13-7-7-7-1.84 0-3.5.71-4.75 1.86l1.43 1.43C9.56 4.5 10.72 4 12 4c2.76 0 5 2.24 5 5zm-5-2.5c-.59 0-1.13.21-1.56.56l3.5 3.5c.35-.43.56-.97.56-1.56 0-1.38-1.12-2.5-2.5-2.5zM3.41 2.86L2 4.27l3.18 3.18C5.07 7.95 5 8.47 5 9c0 5.25 7 13 7 13s1.67-1.85 3.38-4.35L18.73 21l1.41-1.41L3.41 2.86zM12 18.88c-2.01-2.58-4.8-6.74-4.98-9.59l6.92 6.92c-.65.98-1.33 1.89-1.94 2.67z" /></React.Fragment>
<path d="M17 9c0 1.06-.39 2.32-1 3.62l1.49 1.49C18.37 12.36 19 10.57 19 9c0-3.87-3.13-7-7-7-1.84 0-3.5.71-4.75 1.86l1.43 1.43C9.56 4.5 10.72 4 12 4c2.76 0 5 2.24 5 5zm-5-2.5c-.59 0-1.13.21-1.56.56l3.5 3.5c.35-.43.56-.97.56-1.56 0-1.38-1.12-2.5-2.5-2.5zM3.41 2.86L2 4.27l3.18 3.18C5.07 7.95 5 8.47 5 9c0 5.25 7 13 7 13s1.67-1.85 3.38-4.35L18.73 21l1.41-1.41L3.41 2.86zM12 18.88c-2.01-2.58-4.8-6.74-4.98-9.59l6.92 6.92c-.65.98-1.33 1.89-1.94 2.67z" />
, 'LocationOffTwoTone');
Loading

0 comments on commit 5b6f957

Please sign in to comment.