Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strip hash characters from file path #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions lib/generateIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ var svgo = new SVGO({
function generatePng(siz, name, params) {
return new Promise(function(resolve, reject) {
var rsvgConvert;
var color = params.color;
var colorDir = params.color.replace('#', '');
var svgCode = getIconSvg(params, siz);
var filename = pathModule.join(params.destFolder, color, 'png', siz.toString(), name + '.png');
var filename = pathModule.join(params.destFolder, colorDir, 'png', siz.toString(), name + '.png');
rsvgConvert = spawn('rsvg-convert', ['-f', 'png', '-w', siz, '-o', filename]);
if (process.env.INTERMEDIATE_SVG) {
fs.writeFileSync(pathModule.join(params.destFolder, color, 'png', siz.toString(), name + '.svg'), svgCode);
fs.writeFileSync(pathModule.join(params.destFolder, colorDir, 'png', siz.toString(), name + '.svg'), svgCode);
}
rsvgConvert.stdin.end(svgCode);
rsvgConvert.once('error', reject);
Expand All @@ -38,14 +38,16 @@ function generatePng(siz, name, params) {


function generatePngs(name, params) {
var colorDir = params.color.replace('#', '');
return Promise.map(params.sizes, function (siz) {
mkdirp.sync(pathModule.join(params.destFolder, params.color, 'png', siz));
mkdirp.sync(pathModule.join(params.destFolder, colorDir, 'png', siz));
return generatePng(siz, name, params);
}, {concurrency: process.env['JOBS'] || 4});
}

function generateSvg(name, params) {
var svgFolder = pathModule.join(params.destFolder, params.color, 'svg');
var colorDir = params.color.replace('#', '');
var svgFolder = pathModule.join(params.destFolder, colorDir, 'svg');
mkdirp.sync(svgFolder);

return new Promise(function(resolve, reject) {
Expand Down