A dead simple Node Express app that serves static Material Themed docs generated by Mkdocs from behind basic authentication.
- Clone this repo
- Install Node dependencies:
npm i(seepackage.json) - Run
npm startto see the current state of the ebook. - Start with
mkdocs.ymlthis is the configuration file for this book
To be able to edit the ebook you will need to follow these steps first:
- Install Python 3.7+ on to your computer
- Install pip
cd ebook-folderto move into the Python package- run
git clone https://github.com/squidfunk/mkdocs-material.git - Install the Python Packages
pip install -r requirements.txt(Seerequirements.txt) - Run
mkdocs buildto build the markdown files into static HTML files into thesite/directory. - Run
mkdocs serveto serve the generated files fromsite/to port 8000 withOUT username:password authenticationcd .. - Add
.envfile with environment variables
STUDENT_USERNAME=a-username
STUDENT_PASSWORD=a-password
INSTRUCTOR_USERNAME=a-username
INSTRUCTOR_PASSWORD=a-password
PORT=5500cd ..to root director and runnpm start- to serve files fromsite/to port 5500 with username:password authentication- Go to
ebook-folder/mkdocs.ymlfor further instructions + seeebook-folder/workspace - While working in
ebook-folderyou can simply usemkdocs buildandmkdocs serveto by-pass the Node server.
- Finish your changes and check them with
mkdocs serve. - Before you add anything to staging run
mkdocs build. This will ensure you've built the newest intended version of the ebook before you push it to GitHub. git status, add, commit, push ...to repo- Create pull request & merge
Heroku will need some environment variables to perform authentication checks. Add them as you would the variables in .env file using he CLI tools or the dashboard.
ENVIRONMENT:PRODUCTIONSTUDENT_USERNAME:<a-username>STUDENT_PASSWORD:<a-password>INSTRUCTOR_USERNAME:<a-username>INSTRUCTOR_PASSWORD:<a-password>
How to install Python and pip instructions here:
Mkdocs is a Python package that generates statics web files (HTML, CSS, JS), seen in the site/ directory, from plain Markdown files, seen in the docs/ directory.
Material-Mkdocs is another Python package that builds on top of Mkdocs to provide design from the Material-UI Theme. The two receive their configuration from the mkdocs.yaml file. You'll see the navigation is is provided by the nav: property in that file and the Material Theme is the value of theme:.
The Express server is just an app used to serve the static files from site/ behind basic authentication thus the Node app is deployed and not the Python code.