grunt-wigitor v0.1.6
Grunt Wigitor
Description
A demo builder for 'widgets' - a specific UI module setup
Widget stucture
The folder structure of a Wigitor 'widget' should be:
- parent folder must be
widgets - widget folder must follow this naming convention:
- alphanumeric
- no uppercase characters
- no special characters
- no underscores or hyphens
- must end in
wgt - eg -
samplewgt
jsfolder should contain a 'main.js'scssfolder should contain a_module.scssand follow SMACSS guidelines for_state.scssand_layout.scss._vars.scsscan also be used.options.json(see explanation below)README.md(see explanation below)markup.hbsormarkup.ejs, depending on which template you're using. This is the default template for the widget.another-template.hbs. You may add more partials/includes as well, but they will be secondary tomarkup.hbs. (.ejscan also be used)properties/example1.json, which should contain a config object for your widget. Multiple json files allowed and doesn't have to beexample1.json.
options.json
There's also an options.json file in each widget, which contains options for the widget:
configName{string}: This is the name of the config object used when populating the template. It must be unique and should roughly folow the name of the widget with the suffix "Cnf". You can abbreviate if your have a long widget name.templateType{string}: Either "ejs" or "hbs", depending which template you're using.
README.md
Use these custom tags to determine where properties button and Github info goes.
<!--START_WIGITOR_ADDITIONS-->
<!--END_WIGITOR_ADDITIONS-->This only applies if options.json -> modifyReadMes is set to true
Grunt
src
This should be the folder of the widget you're rendering.
dest
This should be the output folder.
options
- pluginDir {string}: path to the
grunt-wigitorplugin directory. Defaults tonode_modules/wigitor. - host: {string}: If running on a server, put the url here. Defaults to an empty string.
- pathToRoot {string}: path to the project root. Defaults to an empty string. Used to normalise EJS includes. Defaults to an empty string.
- pathToApp {string}: path to the root folder where you keep your 'widgets' and other development assets. Defaults to
app/. - gitHubMsg {string}: Github details to print on your readme. Make null or empty string to omit it.
modifyReadMes:falsewill also stop this. - cleanDest {boolean}: Clean the
destfolder before running. Defaults tofalse. Careful with this. - modifyReadMes {boolean}: make
trueto insert a bootstrap popover into your widget'sREADME.md. Also inserts Github details ifgitHubMsgset. - justContent {boolean}: if
false, will render with page template, otherwise will render just with the widget markup - omitScriptTags {boolean}: if
truewill remove any<script>tags from the markup when rendering. - deps {array or strings}: a list of widgets that this widget depends on. Their configs will be added to the global scope when rendering.
- multiProps {boolean}: If
truewill search through the widget'spropertiesfolder and make available all json files as configs. - handlebarsPartials {array of objects}: Objects with details of additional handlebars partials needed for this widget. Partials in the widget's root folder will automatically be added, using the naming convention
samplewgt_my-other-file. Objects must have 2 propertiesname{string} andpath{string}. - containerClasses {string}: Classes for the containing element. Useful for setting light background
wgtvwr-lightbgor Bootstrap grid styles. Should be a single string, separated by spaces. - pageTemplate {string}: Path to your own ejs template. Handlebars not yet supported.
- strictName {boolean}: Whether to apply strict naming convention to widgets - really, whether they must end in
wgtor not. Defaults totrue. - widgetDirName {string}: The name of your widgets directory. Defaults to "widgets".
- forceTemplateType {string}: Override any local options for widget
templateType. Defaults tonull.
Releases
- 0.1.6: Added 'loadJson' helper that allows comments in your JSON files.
- 0.1.5: Added 'forceTemplateType' and bug fix for
destarg inwriteDemofunction. - 0.1.4: Added 'widgetDirName' and bug fix for
destarg inwriteDemofunction. - 0.1.3: Added 'strictName' option.
- 0.1.2: Bug fixes around containerClasses after tested in the wild. Added options 'containerClasses' & 'pageTemplate'.
- 0.1.1: Minor changes to README.md. Still unstable.
- 0.1.0: Initial release. Not properly tested yet. Will probably break.