Skip to content

Commit 22f7a99

Browse files
committed
Add svgo as npm dependency and setup npm script to run it
1 parent 3558505 commit 22f7a99

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Don't track the Node.js installation artifacts
2+
/node_modules/
3+
/package-lock.json

README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,25 @@ npm install --save https://github.com/HatScripts/circle-flags
5555

5656
## Contributing
5757

58-
To contribute, you need to have the latest version of [svgo](https://github.com/svg/svgo) installed.
58+
### Initial setup
59+
60+
To contribute, you need to have the [Node.js](https://nodejs.org) JavaScript runtime installed,
61+
and the latest version of [svgo](https://github.com/svg/svgo).
62+
Once Node.js is set up, you can run the following command to install `svgo` in the circle-flags project directory:
63+
64+
```sh
65+
npm install
66+
```
67+
68+
### Making changes
5969

6070
First, edit the relevant SVG files in the `flags/` directory.
6171

62-
Then run `svgo` to optimize the SVG files:
72+
Then run the `svgo` wrapper script (defined in the `scripts` section of [package.json](./package.json)),
73+
which uses the locally-installed `svgo` executable to optimize the SVG files:
6374

6475
```sh
65-
svgo ./flags --recursive --config=svgo.config.js
76+
npm run svgo
6677
```
6778

6879
Then commit the changes, and submit them as a pull request.

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,11 @@
3333
"bugs": {
3434
"url": "https://github.com/HatScripts/circle-flags/issues"
3535
},
36-
"homepage": "https://github.com/HatScripts/circle-flags#readme"
36+
"homepage": "https://github.com/HatScripts/circle-flags#readme",
37+
"devDependencies": {
38+
"svgo": "^3.0.2"
39+
},
40+
"scripts": {
41+
"svgo": "node_modules/.bin/svgo ./flags --recursive --config=svgo.config.js"
42+
}
3743
}

0 commit comments

Comments
 (0)