A script used with Travis CI to link a subreddit's stylesheet with a Sass repository. As used on /r/anime.
- Have a Reddit API application of type "script" (There are tutorials on this elsewhere, but I'm too lazy to link them)
- Add your repo to Travis CI
.updatedirectory into the root of your repo
- From your repo's settings in Travis, add
REDDIT_PASSWORDas environment variables with the relevant information (make sure you set up
REDDIT_PASSWORDas secure variables so they don't show up in your logs)
main.scss, commit your code, and push to GitHub
- Wait for the Travis build to finish and check out your sub!
Linking multiple subreddits
The update script can take a subreddit name as an argument, which means that you can set up your
.travis.yml deployments to work with multiple subreddits. For example, you could link one branch of your repository to your main sub and another to a private staging sub, you could use the following
.travis.yml deploy config:
deploy: - provider: script script: python .update/updateSubreddit.py mainSubreddit skip_cleanup: true on: branch: master - provider: script script: python .update/updateSubreddit.py stagingSubreddit skip_cleanup: true on: branch: staging
If arguments are passed to the script in this manner, the
REDDIT_SUBREDDIT environment variable will be ignored.
By default the script minified the compiled output before sending it to your subreddit. However, if you'd like to maintain whitespace in your compiled CSS, you can add a
REDDIT_SKIP_MINIFY environment variable to your Travis configuration and set it to anything other than