course-renderer v2.4.0
course-renderer
CA School Course Renderer
Requirements
Installation
npm install course-renderer
Usage
render-course --raw /tmp/raw --dest /tmp/dest course1will render/tmp/raw/course1to/tmp/dest/course1render-course --raw /tmp/raw --dest /tmp/destwill renderallcourses found at/tmp/rawand save it to/tmp/destrender-course --raw /tmp/raw --dest /tmp/dest --content-only course1will rendercourse1SUMMARY.mdandcontentdirectory files only. Useful for validation.
Options
- -r, --raw - (Optional, default to
/tmp/courses-raw) The directory where the raw course will be located. - -d, --dest - (Optional, default to
/tmp/courses-rendered) The directory where the rendered course will be save. - -c, --content-only - (Optional) will only render the
SUMMARY.mdand thecontentdirectory files. - -s, --silent - (Optional)
render-coursewill be in silent mode. Only output errors toSTDOUT
Arguments
- Arguments passed to
render-courseare treated asCourse Name. Passing a list of argument will render those courses. - If you do not pass anything, then
render-coursewill render everything from therawdirectory.
Custom Rendering
If you want to execute your custom rendering routines, you will need to import customRender function from this package.
Then your custom rendering functions should expect a single parameter, a vinyl object. You will need to return that same object itself with the updated
contents.
The example below will add the bootstrap btn and btn-primary class to the course buttons
import { customRender } from 'course-renderer';
function myCustomRenderer(file) {
const ch = cheerio.load(file.contents.toString())
ch('.ca-verify-button').addClass('btn btn-primary')
file.contents = new Buffer(ch.html())
return file
}
customRender('/path/to/your/course', myCustomRenderer, (error) => {
// Do something after
})Authors
- Jerome Suarez github/TenshiLyle
- Sandae Macalalag github/sandaemc
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago