Minimalist static site generator, powered by Node.js & nanogen for use in MCAD web & screen classes.
- Generate HTML pages from EJS and/or Markdown files.
- The site can have a global layout (the common header, navigation, footer) and some pages may have a specific one.
- It can read site metadata from a global file and have specific data for individual pages.
- Allow partials (blocks of reusable interface components)
- copies local media to exact locations in the build process (inside subdirectories on a page by page basis)
-
page
is available in your template to get access to the current page's front matter & a list of local media as root relative absolute file paths. - generates a
pages
array, available in your template, containing json objects for each of the page definitions across the entire site. Thepages
objects has a few reserved keys you should not use in your front matter (they will be overwritten).-
url
– the root relative absolute url to the page -
media
– an array of root relative absolute paths to the media files associated with the page -
depth
– the depth of the page in the folder structure
-
- Node.js installed (version 8 or above)
You may install it globally with:
npm i -g mcadgen
Or run the cli directly with npx (available with npm 5.2 or above):
npx mcadgen <command>
To create a brand new site, navigate to the folder you want your site to be and run:
mcadgen init
This will create a initial site structure like this:
/
src/
assets/
layouts/
pages/
partials/
site.config.js
To build the site and open it in a browser, run:
mcadgen start
There is already a default layout inside the layouts
folder, but you may add more.
Read more about Layouts.
Inside the pages
folder is where you put ejs, md or html files that will generate the pages of the final site. Any file name and folder structure used here will be transposed to the resulting site (without the pages
part).
Read more about Pages.
You may run mcadgen -h
to see the available commands and options:
Initialize a new site:
$ mcadgen init
Start the current site:
$ mcadgen start [options]
Build the current site:
$ mcadgen build [options]
Options
-c, --config <file-path> Path to the config file (default: site.config.js)
-p, --port <port-number> Port to use for local server (default: 3000)
-h, --help Display this help text
-v, --version Display mcadgen version
Read the full documentation for nanogen
MCADgen is intended to be used at the root of your site '/'. It's not advised but you can use it in a sub directory with the following steps:
- upload your files to a subdirectory
- create a .htaccess file (or modify the existing one) at the root subdirectory
- add the rewrite settings below, while changing the subdirectory name (
coolsite
) to the appropriate sub directory name, and changing the url to your own url including the sub directory.
RewriteEngine on
RewriteCond %{HTTP_REFERER} ^http://mygreaturl.com/coolsite/
RewriteCond %{REQUEST_URI} !^/coolsite/
RewriteRule (.*) /coolsite/$1 [L,QSA]
- Derek Anderson && Ben Moren – mcadgen
- Douglas Matoso - Initial work - doug2k1
This project is licensed under the MIT License - see the LICENSE file for details