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

Add svgo as npm dependency and set up npm script to run it #100

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
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
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"
}
}