jquery-boilerplate/jquery-boilerplate
Fork: 515 Star: 2524 (更新于 2024-11-03 12:46:37)
license: 暂无
Language: JavaScript .
A jump-start for jQuery plugins development
最后发布版本: v4.1.0 ( 2016-02-23 04:01:29)
jQuery Boilerplate
A jump-start for jQuery plugins development
So, you've tried your hand at writing jQuery plugins and you're comfortable putting together something that probably works. Awesome! Thing is, you think there might be better ways you could be writing them - you've seen them done a number of different ways in the wild, but aren't really sure what the differences between these patterns are or how to get started with them.
This project won't seek to provide a perfect solution to every possible pattern, but will attempt to cover a simple template for beginners and above. By using a basic defaults object, simple constructor for assigning the element to work with and extending options with defaults and a lightweight wrapper around the constructor to avoid issues with multiple instantiations.
Usage
-
Include jQuery:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
-
Include plugin's code:
<script src="dist/jquery.boilerplate.min.js"></script>
-
Call the plugin:
$("#element").defaultPluginName({ propertyName: "a custom value" });
Structure
The basic structure of the project is given in the following way:
├── demo/
│ └── index.html
├── dist/
│ ├── jquery.boilerplate.js
│ └── jquery.boilerplate.min.js
├── src/
│ ├── jquery.boilerplate.coffee
│ └── jquery.boilerplate.js
├── .editorconfig
├── .gitignore
├── .jshintrc
├── .travis.yml
├── Gruntfile.js
└── package.json
demo/
Contains a simple HTML file to demonstrate your plugin.
dist/
This is where the generated files are stored once Grunt runs.
src/
Contains the files responsible for your plugin, you can choose between JavaScript or CoffeeScript.
.editorconfig
This file is for unifying the coding style for different editors and IDEs.
Check editorconfig.org if you haven't heard about this project yet.
.gitignore
List of files that we don't want Git to track.
Check this Git Ignoring Files Guide for more details.
.jshintrc
List of rules used by JSHint to detect errors and potential problems in JavaScript.
Check jshint.com if you haven't heard about this project yet.
.travis.yml
Definitions for continous integration using Travis.
Check travis-ci.org if you haven't heard about this project yet.
Gruntfile.js
Contains all automated tasks using Grunt.
Check gruntjs.com if you haven't heard about this project yet.
package.json
Specify all dependencies loaded via Node.JS.
Check NPM for more details.
Guides
How did we get here?
Have you got in this repo and still not sure about using this boilerplate?
Well, extending jQuery with plugins and methods is very powerful and can save you and your peers a lot of development time by abstracting your most clever functions into plugins.
This awesome guide, adapted from jQuery Plugins/Authoring, will outline the basics, best practices, and common pitfalls to watch out for as you begin writing your plugin.
How to publish plugins?
Also, check our guide on How to publish a plugin in jQuery Plugin Registry!
Note: The jQuery Plugin Registry is in read-only mode. New plugin releases will not be processed. jQuery recommends moving to npm, using "jquery-plugin" as the keyword in your package.json. See how to publish into npm registry.
Team
jQuery Boilerplate was made with love by these guys and a bunch of awesome contributors.
Zeno Rocha | Addy Osmani | Helder Santana |
Contributing
Check CONTRIBUTING.md for more information.
History
Check Releases for detailed changelog.
License
MIT License © Zeno Rocha
最近版本更新:(数据更新于 2024-09-13 19:05:27)
2016-02-23 04:01:29 v4.1.0
2016-01-03 03:18:35 v4.0.0
2016-01-03 03:10:07 v3.5.0
2015-01-22 08:04:03 3.4.0
2013-09-27 09:39:20 3.3.1
2013-09-27 09:39:05 3.3.0
2013-09-27 09:38:48 3.2.0
jquery-boilerplate/jquery-boilerplate同语言 JavaScript最近更新仓库
2024-11-09 19:30:14 vernesong/OpenClash
2024-11-05 19:13:47 jerryc127/hexo-theme-butterfly
2024-11-05 13:53:42 LiteLoaderQQNT/LiteLoaderQQNT
2024-11-03 02:40:36 chris81605/Degrees-of-Lewdity_Cheat_Extended
2024-11-01 21:55:46 projectdiscovery/nuclei-templates
2024-11-01 19:24:44 NumberSir/DoL-I18n-Build