There are several ways to create and manage D3 Blocks at bl.ocks.org. The easiest is probably to use Blockbuilder. One can also copy/paste code directly into the Gist ui at gist.github.com.
However, if you want to use git
from from the command line to manage your Blocks (just like you manage your regular Github repos), follow these steps:
ssh
keys in your Github account, as https
no longer works for accessing the Gist repo from the command line or SourceTree etc. Please see here for instructionsREADME.md
file and add some text (you can add modify later)cfa24192d5d624f702446f194c1a7708
(which happens to be the unique id of this particular Gist)git clone git@gist.github.com:YOUR_UNIQUE_GIST_ID
remote
git configuration with the command git remote -v
README.md
file in your text editor, make some changes, then savegit status
, and you'll see that the README.md
file has been changedgit add .
git commit -m "Updated README.me"
git push
README.md
file has changed.index.html
with a max window size of 960x500 pixels, b) there should be an README.md
file that describes your visualization, and c) there can also be a thumbnail.png
file with the size of 230x120 pixelsindex.html
file in this Gist repo loads three files:
styles.css
file which configures the window to the correct size for a D3 Blockindex.js
file. The file is currently almost empty (only console logs the d3 version). Put your visualization code in this file. The file is loaded by the index.html
with the defer
attribute, so the DOM is fully loaded by the time the index.js
begins executionindex.js
file. Test your work in process by opening up the index.html
file in your browser. Keep iterating until donegit add .
(please note the period). This command which will stage all changes (and any additional files that you may have added). Commit the staged file(s) with the command git commit -m "Commit message..."
(customize the commit message to describe the actual work you're committing)git push
index.html
, index.js
, styles.css
) and any other files that you may have addedhttps://bl.ocks.org/YOUR_GIT_ID
. After a few minutes you should be able to see your new Block!Additional Resources:
https://bl.ocks.org/emmasaunders/2ac8e418958f4c681f229f82729c9647 https://miningthedetails.com/blog/d3/CreatingD3Blocks/
https://cdnjs.cloudflare.com/ajax/libs/d3/5.16.0/d3.min.js