MOT Test Certificates
NodeJS/Express application which generates a PDF certificate from handlebars template using flyingsaucer.
This application is hosted on heroku (cedar-14 stack) using the address below.
**It is password protected, please contact repo owner to retreive details from the Heroku account under settings **
- You will need latest versio node/npm and JDK
- Clone this repository and cd into it using terminal
- Install all npm dependencies
NPM is used to import certain packages required for this project. You can find the depenceny list inside of the package.json file.
This script is used to to start gulp watch task and run express server with nodemon. The NODE_ENV is automatically set to development, which is used inside of certain gulp tasks.
npm run start-dev
This will start a local server located at the address below:
To build assets it runs the gulp build task which is documented further down on this page.
npm run build-production
This is java application which generates a PDF from HTML using iText.
This application uses two jar files from the compiled version of flyingsuacer and itext. These are located in the flyingsaucer folder.
This is the templating language used. The data is taken from JSON files found inside of the data directory.
GulpJS is used to process the assets files (images and scss).
It is also used to move files into the dist folder once building for production use.
You can find the source code of all gulpjs tasks inside of the gulp folder.
This will run all of the tasks in series to build all assets. This is used to build production assets for dist folder before publishing. You are required to also set the NODE_ENV to production.
This task is used to move all font files into the dist folder.
This task is used to move all image assets into the distribution folder. If NODE_ENV is set to production then it will also compress images with imagemin.
This task is used to pre-process the scss files into normal css files.
You can import npm packages into the scss files by using the package name, instead of the full node_modules path.
The task will use autoprefixer to automatically add any prefixes required for CSS 2.1 which is used by flyingsaucer.
When NODE_ENV is set to production it will also minify all css using cssnano.
When NODE_ENV is set to development it will also include sourcemaps inside of the css file.
This task is used to move all view templates into the distribution folder. This is only used as part of the build task before publishing.
This task will compile all of the handlebars templates into html with inline stylesheets. This is used as part of the build production to allow for easier development.
This task is used to run scss, images and fonts tasks and watch for any changes to the scss or image assets. When a change is made it will automatically re-run that particular task.
Docker setup for development
You will need the latest version of docker installed
Running development mode
For faster development you can use docker by running the following command:
After which the server is located at the local address below:
Run the following command
docker-compose run --rm app npm run build-production