Code Monkey home page Code Monkey logo

Detroit Ledger Frontend

This code produces the site you see on the Detroit Ledger

Installation

npm install -g gulp
npm install -g bower
npm install
gem install sass
gem install compass

See .travis.yml for an example of how to fulfill the compass and sass dependencies if they give you trouble.

Development

gulp watch to recompile and run tests on file change

gulp watch-sans-test to recompile without tests on file change

gulp build to build the site for deployment

Installing a new module

Say you need a new third party library like jquery or bootstrap:

  1. Add it to bower.json
  2. gulp install
  3. Add it to package.json -- make sure it's under browser.

Prerender

We use a little proxy server to pre-render pages for SEO.

First, you'll need to get a prerender service running somewhere.

Then, configure this app to use that service:

$ export PRERENDER_SERVICE_URL=<new url>

Or on heroku:

$ heroku config:add PRERENDER_SERVICE_URL=<new url>

You can customize the port the proxy server listens to:

$ export PORT=<8080>

Finally, run the server:

$ node server.js

To test that things are working, vist a URL and change the #! to ?_escaped_fragment_=. If you view source, you should see the full content.

Docker

In your local repo, git remote add live [email protected]:repos/detroitledger.git.

Later on, git push live gh-pages when you want to deploy.

In the background, the following post-receive hook happens:

#!/usr/bin/env bash

. $HOME/.nvm/nvm.sh

export GIT_WORK_TREE="$HOME/repos/detroitledger"
git checkout -f gh-pages

cd $GIT_WORK_TREE

npm install
gulp install
NODE_ENV=production gulp build
docker build -t detroitledger/gnl-frontend:`cd ../detroitledger.git && git log --pretty=format:'%h' -n 1` .
docker stop gnl-frontend
docker rm gnl-frontend
docker run -d --name=gnl-frontend -e PRERENDER_SERVICE_URL=http://`docker inspect --format='{{.NetworkSettings.IPAddress}}' prerender`:3000 detroitledger/gnl-frontend:`cd ../detroitledger.git && git log --pretty=format:'%h' -n 1`

Troubleshooting

Get an error like this when running gulp watch?

[10:39:02] Error: Test server exited prematurely.
    at ChildProcess.handlePrematureExit (/Users/matth/projects/detroit/detroitledger/node_modules/exec-wait/index.js:49:25)
    at ChildProcess.g (events.js:199:16)
    at ChildProcess.emit (events.js:110:17)
    at Process.ChildProcess._handle.onexit (child_process.js:1078:12)

You probably already have something running on port 8080. Run sudo lsof -i :8080 to find it.

Detroit Ledger's Projects

990-api icon 990-api

An API for finding 990 data by EIN from the IRS Business Master File

gnl_profile icon gnl_profile

API & data management system for the Detroit Ledger

grantentry icon grantentry

provide a dashboard for volunteers to enter grants from 990 pdfs

irs-xml-tools icon irs-xml-tools

Tools for working with the IRS 990 XML data https://aws.amazon.com/public-datasets/irs-990/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.