You will need Node, Homebrew, Git and Git LFS installed to complete setup.
You can test to see if you already have Homebrew installed by running
brew -v
If it gives you a version, (e.g. Homebrew 3.3.11
) you already have it installed! If you get a message like command not found
you will need to install it using this command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Check if you have Node installed by running:
npm -v
If it gives you a version, (e.g. 8.3.1
) you already have it installed! If you get a message like command not found
you will need to install it using this command:
brew install node
You probably already have git
installed, but just in case you don't, check by running:
git --version
If it's installed, you'll see something like git version 2.34.1
. Otherwise, install it with:
brew install git
This project also requires Git LFS. You can install it with:
brew install git-lfs
Once all prerequisites are installed, you can set up the Refcode Development Environment.
Clone the repository to a local directory and navigate to that directory with your terminal.
Run the following commands:
npm install
git lfs install
Once you've run those two commands, the repository should be ready to run using the commands below.
Once you are set up you will have the following scripts available for use.
You'll use this command to spin up the development environment for doing work on the website. This allows you to see your changes on the website at http://localhost:3000.
npm start
control + C
in the terminal.This command does a full build and is sometimes necessary to get things configured correctly, e.g. when changes to images have been made, they won't show up in the Development Environment until after this command is run.
npm run build
build
folder.\npm start
without ever having run this command, all images will be broken. This command will also need to be run again to see any subsequent image changes. Added a new image? Run npm run build
. Edited an image? Run npm run build
. Some image isn't working in the dev environment? Run npm run build
!This repository uses an image optimizer that automatically creates multiple sizes of images and then uses JavasScript to insert
srcset
attributes into the image so that the browser can automatically retrieve the best image size. This improves the performance of the website, especially on mobile devices.
In order to have an image use this, the page must include the createSrcSet.js
script, and the image must use the attribute data-src
instead of src
. For example, instead of <img src="https://github.com/team-refcode/refcode.org/raw/master/./img/myImage.jpg">
it should be <img data-src="https://github.com/team-refcode/refcode.org/raw/master/./img/myImage.jpg">
.
This won't work until npm run build
is run, which will look through all images and create the multiple sizes. If there is ever an error running this script, it may be due to a non-supported file (such as .DS_Store
) accidentally being placed in the /img folder.
Note, images should be placed in /img
not /public/img
, which is the output.
Images that have a /
or .
character in them will break this script.
This project was bootstrapped with Create React App. The following is the standard information that every Create-React-App project contains. You usually won't need to refer to these links, but they may be helpful.
You can learn more in the Create React App documentation.
To learn React, check out the React documentation.
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
npm run build
fails to minifyThis section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify