
Product
Introducing GitHub Actions Scanning Support
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.
@seamly/doc-site
Advanced tools
This package allows you to easily build a documentation site with Webpack/Markdown/EJS. It provides:
This package allows you to easily build a documentation site with Webpack/Markdown/EJS. It provides:
lib/config/site.js) with:
PROJECT_PATH/site.conf.jsloaders/ejs-layout-loader.js) that supports:
frontmatter-markdown-loader)loaders/html-url-rewrite-loader.js) that supports:
<img src=""> and <link href="~..."> only)loaders/import-loader.js) that supports:
exportType set to string.Some assumptions:
public in the examples belowIn your webpack.config.js:
const site = require('@seamly/doc-site/lib/config/site')
const SITE_ROOT = path.resolve(__dirname, 'public')
// Your usual webpack setup.
module.exports = function(env = {}, argv = {}) {
const config = {}
return site.addSiteConfig(config, {siteRoot: SITE_ROOT})
}
In your public folder add markdown (.md), HTML (.html) or EJS (.ejs) files. Add some front-matter to define what layout to use.
---
layout: doc.ejs
toc: false
pageTitle: My page
---
# This is my page
Additionally you can setup a site.conf.js which should expose an object as in the example below. It will be used in the layout/templates.
module.exports = {
// Title of the site (optional, default is name from package.json)
title: "My Site",
// Subtitle (optional, default is version from package.json)
subTitle: "by me",
// Extra items to render in the HEAD tag (optional)
head: [
"<script src='/lib/helpers.js'></script>"
],
// The navigation tree. Can only be 2 levels deep (rest is ignored)
// The URL in the toplevel is optional
navigation: [
{
title: "Demos",
children: [
{
title: "Demo 1",
url: "/demos/demo1.html"
},
{
title: "Demo 2",
url: "/demos/demo2.html"
},
],
title: "Versions",
url: "/versions"
}
]
}
addSiteConfigThe addSiteConfig config transform will take your Webpack config as first parameter and will add the following:
.md, .html and .ejs files within the provided siteRoot matching exclude and include and add them as entries to the webpack config.exclude and include.scss files within the @seamly/doc-site package (make sure you exclude them if you have another rule matching .scss files).html and .ejs files matching exclude and include.md files matching exclude and includepackage.json and expose version, name and description to templates in the data.pkg keysite.conf.js and expose it to templates in the data.site keyYou can pass the following options:
siteRoot (String, required): the directory where your site residestemplateGlobals (Object): an object of extra properties to expose to the templates in the data keyoutputName (String,Function): Function or string passed to file-loaderexclude (String,Array): Passed to webpack rulesinclude (String,Array): Passed to webpack ruleshtmlExtractLoadersLoader chain to use for processing HTML and emitting HTML to files.
ejsLoadersLoader chain to use for processing EJS files with markdown support. Uses htmlExtractLoaders to emit files.
markdownLoadersLoader chain to use for processing markdown files, will wrap with layout. Will not emit files.
assetScssLoadersLoader chain to use for processing .scss Sass files to be written to file as Asset modules.
styleScssLoadersLoader chain to use for processing .scss Sass files to be inlined with the style loader (the style loader is already part of this chain).
ejs-layout-loader.jsThis loader does 3 things:
Options for this loader are:
exec (boolean): Wether or not we should execute the modulecontentPlaceholder (String): The replacement string to inject the content into the layoutlayoutPath (Array): Path where to find layoutsglobals (Object): Data to merge into top level datatoc (boolean): Should we generate TOC?getFrontMatter (Function): What to use to extract the frontmattergetContent (Function): What to use to get the contentdefaultLayout (String, null): The defaul layout to ushtml-url-rewrite-loader.jsThe html-url-rewrite-loader is a (limited) drop-in replacement for the HTML loader it will:
See LICENSE
FAQs
This package allows you to easily build a documentation site with Webpack/Markdown/EJS. It provides:
We found that @seamly/doc-site demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.

Product
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.

Research
The Socket Threat Research Team uncovered malicious NuGet packages typosquatting the popular Nethereum project to steal wallet keys.