npm install generator-courier#generator-courier
A Yeoman generator for data journalists, map-makers and others.
Included are several options for making maps with Leaflet. For instance, you can use JSON files with latitude and longitude coordinates in them to create a map. This generator will also scaffold out a map that uses GeoJSON file(s). You are also given the options for using Tabletop to pull data from a Google spreadsheet or Handlebars to template the data.
You can also create a searchable database using DataTables.
NOTE: This generator uses Require.JS, so it's probably best to familiarize yourself with that library before using this generator. Also, you can use SASS with your projects if you like.
npm install -g generator-courier
yo courier
Depending on what you choose, you will be asked more questions. If you decide to create a map, you will be asked about how you want the data formatted. For instance, you can use GeoJSON file(s) and create a drop-down menu to filter through GeoJSON properties (example:). You will also be asked a few questions about how you want the map to look. You can use circle markers, large popups boxes with your markers (example:) and marker clusters courtesy of the Leafet cluster plugin.
If you decide you don't want to create a map, you will be given fewer options.
grunt app
A prebuilt project will now be created in the 'app' folder. Sample data and all the necessary dependencies will also be created. You can then delete the data and replace it with your own. If you are using Tabletop, you can switch out the sample spreadsheet key in JS file with your own key.
This generator uses live reload, so when you make changes to your files, the project be automatically re-loaded on your local server.
If you are using SASS, the .scss files will be automatically compiled to CSS files whenever you re-save your project. If you are having trouble with compiling your CSS files, you can run:
grunt server
A new folder will be created that ends in "-public". All your CSS and JS files will be combined and minified into that folder. All other files (like image files, for instance) will be copied to that folder as well. A local server will open your index.html file so you can make sure everything looks right.
A Courier logo is also used with the app, which you will want to delete or replace.
Also, the tweet button references our Twitter handle, which you will want to change.