newsletter for quantmetry
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
conf
gulp_tasks
newsletter_builder
src
.editorconfig
.gitattributes
.gitignore
.yo-rc.json
README.md
bower.json
build_newsletter_data.sh
construire_le_site.docx
gulpfile.js
package.json

README.md

This is the source code for the Newsletter project. The live website is hosted by github.

Usage

Deployment

I use gulp to run the website locally and deploy it to github.

Checking that the website works

# Run local temporary version
$ gulp serve
# Build actual website
$ gulp build
# Run built version
$ gulp serve:dist

Deploying

I rely on github pages to host the website. I use the gulp-gh-pages tool to deploy the website to the github-page branch of the repository. When the built website works properly, you have to

  • modify src/index.html to match the deployment state
  • build the website again
  • deploy

Here is how the html should be modified:

<html>
  <head>
    <!-- version dist github -->
    <!-- <base href="/newsletter/"> -->
    <!-- version locale -->
    <base href="/">

Here are the commands to deploy:

 # Assuming src/index.html was properly changed
 # Build the website again
 $ gulp build
 # Don't try to `gulp serve:dist` at this point
 # deploy
 $ gulp deploy

Building data

I created a Python script to parse an ensemble of .docx files and convert them to a specific JSON format. The script is launched with a bash script:

$ bash build_newsletter_data.sh

Parameters of the Python script are in newsletter_builder/application/config.ini. The generated JSON files are to be placed in src/data/

Note: the Python project uses absolute imports and assumes that this project was added to the $PYTHONPATH.