Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/styled-components/s-c.sh
The styled-components URL shortener!
https://github.com/styled-components/s-c.sh
styled-components url-shortener
Last synced: about 1 month ago
JSON representation
The styled-components URL shortener!
- Host: GitHub
- URL: https://github.com/styled-components/s-c.sh
- Owner: styled-components
- Created: 2019-01-14T12:42:15.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-29T09:24:58.000Z (almost 6 years ago)
- Last Synced: 2024-09-29T00:01:44.715Z (about 1 month ago)
- Topics: styled-components, url-shortener
- Homepage: https://s-c.sh
- Size: 12.7 KB
- Stars: 30
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-list - s-c.sh - components URL shortener! | styled-components | 31 | (Others)
README
# `s-c.sh`
The styled-components link shortener, based on [`netlify-shortener`](https://github.com/kentcdodds/netlify-shortener).
## Adding a new short link
All you have to do to add a new short link is to [edit the `_redirects` file](https://github.com/styled-components/s-c.sh/edit/master/_redirects) and add your redirect at the very top in the format `/ https://link.com`. For example:
```sh
/medium https://medium.com/styled-components
/css-prop https://medium.com/styled-components/announcing-native-support-for-the-css-prop-in-styled-components-245ca5252feb
```Now `s-c.sh/medium` will redirect to the styled-components Medium publication, and `s-c.sh/css-prop` to the CSS prop announcement post!
:tada: :tada: :tada:
### From the command line
You can also use the `netlify-shortener` CLI locally to add new short links, which will make sure the `_redirects` file is in the right format. To do so, you need to set up this repository locally:
1. Clone the repo with `git clone [email protected]:styled-components/s-c.sh`
2. Install the dependencies with `npm install` (or `yarn`)Once you have the repo set up locally, you simply have to run one command to add a new shortcode:
```sh
npm run shorten# for example
npm run shorten https://styled-components.com/docs d # s-c.sh/d will redirect to the docs now
```> Note that you need to have **write access to the repository** for this to work. If that is not the case, you'll need to fork the repo first and push to your fork before submitting a PR.
## How does it work?
Redirects are added to the `_redirects` file, which is deployed to Netlify and handled by them. The `master` branch in this repo is always in sync with s-c.sh!
## License
This whole repository is licensed under the MIT license.