This is the Miami Herald's template for building interactive graphics online.
The template is an upgrade from a previous version written in Python.
The new version, inspired by The Texas Tribune's graphic template, is written in JavaScript with task management handled by Gulp.
CSS:
- Bootstrap - Responsiveness
_base.scss
- Miami Herald styles imported intostyles.scss
.
JS:
- D3 - Data visualizations
- jQuery – DOM manipulation
- Bootsrap – Bootstrap components
- Modernizr – Detection
- Sinclair – Miami Herald's library
HTML:
-
base.html
– Uniform page. This is where everything but the content is built, including SEO and footer. -
index.html
- Where the content lives, which includes headline, byline and text.
GULP:
- BrowserSync - Live browser
- SASS - SCSS/CSS compiling
- JSHint - JavaScript linting
- Nunjucks - JavaScript templating
- Shell - Run commands in the command line
More to come...
Before you begin, make sure you have Node.js installed on your computer.
If all systems go:
-
Clone repo.
-
Rename folder to project name.
-
In Terminal,
cd
into folder. -
If there is no
node modules
folder, runnpm install
. All dependencies are inpackage.json
. -
cd
intoapp
. Then runbower-installer -r
for all CSS and JS libraries. Settings are inbower.json
. -
To start working, go to command line and run
gulp
. All tasks can be found ingulpfile.js
.
6a. During development, run jshint /path/to/file.js
for any JS files Gulp isn't watching.
- Once finished. Run
gulp build
to create file. You're done!
-
In Google Spreadsheets, copy from this template and make a new document.
-
Using oAuth2, you need to make sure you're authorized to use the spreadsheet. At the project root, run
npm run authorize
. Any problems can be configured in/bin/authorize.js
. -
Running
gulp
will update the text thanks to gulp-shell, which takes care of writingnpm run fetch/spreadsheet
in the command line. The spreadsheet is downloaded intodata.json
. Nunjucks will take the data and write intoindex.html
andbase.html
. -
If there's anything wrong. Check to make sure you have the following at the ~.
~/.mh_app_google_client_secrets.json
and~/.mh_app_token.json
.
Questions or suggestions? Contact me at [email protected]