Skip to content

Commit 6679c75

Browse files
committed
flag width can be calculated from height
1 parent 4290eec commit 6679c75

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

grunt/generate-sprite.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ module.exports = function(grunt) {
88
const supportedFilenames = supportedCountries.map(country => `${country.iso2}.svg`).sort();
99
const done = this.async();
1010

11-
const TARGET_WIDTH = 16;
11+
// customise this number to change the size of the flags (NOTE: flags are 4x3 ratio)
1212
const TARGET_HEIGHT = 12;
13+
14+
const TARGET_WIDTH = (TARGET_HEIGHT / 3) * 4;
1315
const FLAG_MARGIN = 0;
1416

1517
const specialCases = {
@@ -104,15 +106,15 @@ module.exports = function(grunt) {
104106

105107
// Generate SCSS content
106108
outputFileContent += fileWarning + "\n\n";
107-
109+
108110
outputFileContent += `$flags-sprite-1x: (\n`;
109111
outputFileContent += ` height: ${maxHeight}px,\n`;
110112
outputFileContent += ` width: ${totalWidth}px,\n`;
111113
outputFileContent += ");\n\n";
112114

113115
outputFileContent += `$flag-width: ${TARGET_WIDTH}px;\n\n`;
114116
outputFileContent += `$flag-height: ${TARGET_HEIGHT}px;\n\n`;
115-
117+
116118
outputFileContent += flagsMetadata + "\n\n";
117119
outputFileContent += fileWarning + "\n";
118120

0 commit comments

Comments
 (0)