Skip to content

Commit

Permalink
Add svgo as npm dependency and setup npm script to run it
Browse files Browse the repository at this point in the history
  • Loading branch information
waldyrious committed Jun 11, 2023
1 parent 3558505 commit 22f7a99
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Don't track the Node.js installation artifacts
/node_modules/
/package-lock.json
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,25 @@ npm install --save https://github.com/HatScripts/circle-flags

## Contributing

To contribute, you need to have the latest version of [svgo](https://github.com/svg/svgo) installed.
### Initial setup

To contribute, you need to have the [Node.js](https://nodejs.org) JavaScript runtime installed,
and the latest version of [svgo](https://github.com/svg/svgo).
Once Node.js is set up, you can run the following command to install `svgo` in the circle-flags project directory:

```sh
npm install
```

### Making changes

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

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

```sh
svgo ./flags --recursive --config=svgo.config.js
npm run svgo
```

Then commit the changes, and submit them as a pull request.
Expand Down
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,11 @@
"bugs": {
"url": "https://github.com/HatScripts/circle-flags/issues"
},
"homepage": "https://github.com/HatScripts/circle-flags#readme"
"homepage": "https://github.com/HatScripts/circle-flags#readme",
"devDependencies": {
"svgo": "^3.0.2"
},
"scripts": {
"svgo": "node_modules/.bin/svgo ./flags --recursive --config=svgo.config.js"
}
}

0 comments on commit 22f7a99

Please sign in to comment.