Skip to content

A plain UMD vanilla javascript plugin boilerplate with optional jQuery initialization for the sake of convenience

License

Notifications You must be signed in to change notification settings

janrembold/vanilla-plugin-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vanilla Plugin Boilerplate

A plain UMD vanilla javascript plugin boilerplate with optional jQuery initialization for the sake of convenience. This boilerplate is useful for small or fast scripts that don't necessarily need jQuery.

Usage

Change pluginName variable to your desired plugin name and include the plugin.

Initialize the plugin to a single html element with plain vanilla javascript.

var boilerplate = new Boilerplate(document.getElementById('demo'), {
    someDefaultOption: 'Plugin was loaded vanilla style!'
});

boilerplate.doSomething();

Or append the plugin to a collection of elements with a jQuery selector. The plugin object will be attached to each elements data attribute. The data attributes name is plugin_ prefixed to the given pluginName.

$('.demo').Boilerplate({
    someDefaultOption: 'Plugin was loaded jQuery style!'
});

$('.demo').data('plugin_Boilerplate').doSomething();

License

  • Author: Jan Rembold
  • License: MIT

About

A plain UMD vanilla javascript plugin boilerplate with optional jQuery initialization for the sake of convenience

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages