Skip to content

Commit

Permalink
Merge pull request #27 from varvet/publish-to-npm
Browse files Browse the repository at this point in the history
Prepare for npm publication
  • Loading branch information
Johan Halse authored May 7, 2019
2 parents f903fb7 + 957556b commit 6d8c88d
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 7 deletions.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,24 @@ Note: while you can use Tiny Autocomplete with a local data source, the pattern

## Installation

Just include tiny-autocomplete.js after Zepto or jQuery. Include tiny-autocomplete.css and you're good to go!
### Global installation

If you're not using any package managers, put tiny-autocomplete.js after Zepto or jQuery, include tiny-autocomplete.css, and you're good to go!

### Installing through npm

If you're using npm to manage your dependencies, first install the tiny-autocomplete module:

```javascript
npm install -s @varvet/tiny-autocomplete
```

Then require it in your files and activate it after your jQuery or Zepto library, like so:

```javascript
var $ = require("jquery");
require("@varvet/tiny-autocomplete")($, window);
```

## Demos

Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
"keywords": [
"jquery",
"zepto",
"search-as-you-type",
"jquery-plugin",
"ecosystem:jquery",
"zepto-plugin",
"ecosystem:zepto",
"autocomplete",
"plugin",
"extensible"
Expand Down
11 changes: 8 additions & 3 deletions src/tiny-autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
* @version 1.0.0
* @return {object} Self
*/
(function(window, $) {

var factory = function($, window) {
var TinyAutocomplete = function(el, options) {
var that = this; // This is just to minify better
that.field = $(el);
Expand Down Expand Up @@ -668,6 +669,10 @@
this.tinyAutocomplete = { settings: d.settings };
});
};
};

$.tinyAutocomplete = TinyAutocomplete;
})(window, $);
if (typeof exports !== "undefined") {
module.exports = factory;
} else {
factory($, window);
}

0 comments on commit 6d8c88d

Please sign in to comment.