Skip to content

Instantly share code, notes, and snippets.

@clpetersonucf
Last active July 19, 2019 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clpetersonucf/261a8b7a2d89c6c9304ece6b52cfc1b7 to your computer and use it in GitHub Desktop.
Save clpetersonucf/261a8b7a2d89c6c9304ece6b52cfc1b7 to your computer and use it in GitHub Desktop.
Adding Helper Docs to Materia Widgets

package.json:

Update MWDK to 2.4.2: "materia-widget-development-kit": "2.4.2"

Directory structure:

src/_guides/creator.md
src/_guides/player.md

All image assets should be in src/_guides/assets/

Add guide entries to the widget's install.yaml:

creator_guide: guides/creator.html
player_guide: guides/player.html

Webpack config:

Note that the configs required here are all that's necessary for the helper docs to work. Older configurations, like the generateHelperPlugin function, aren't required and can be removed.

Add temp files to the entry config: (Note that this requires the path module to be included (const path = require('path')) - if the config is using a srcPath variable to track the directory path, you can use that instead. This may vary from widget to widget.)

const entries = {
    'guides/player.temp.html': [
		    path.join(__dirname, 'src', '_guides', 'player.md')
	    ],
	    'guides/creator.temp.html': [
		       path.join(__dirname, 'src', '_guides', 'creator.md')
	    ]
  }

Ensure the entry config is added as an option being passed to the getLegacyWidgetBuildConfig() method:

const options = {
    entries: entries
}

let buildConfig = widgetWebpack.getLegacyWidgetBuildConfig(options)
module.exports = buildConfig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment