<commit_before>![icon](http://alves.im/minigrid/assets/favicon-32x32.png)

Minigrid is a minimal 2kb zero dependency cascading grid layout.

**[Demo](http://alves.im/minigrid/)**

## Install

`npm install minigrid`

Using Bower:

`bower install minigrid`

## Usage

```html
<div class="grid">
  <div class="grid-item"></div>
  <div class="grid-item"></div>
  <div class="grid-item"></div>
  <div class="grid-item"></div>
</div>
```

```js
var grid = require('minigrid');
grid('.grid', '.grid-item');
```

## API

### `minigrid(containerSelector, itemSelector, gutter, animate, done)`

- **containerSelector** - `string`: required. The element selector where your grid items sit.
- **itemSelector** - `string`: required. The grid item element selector.
- **gutter** - `number`: optional. The space between items, the default is `6`.
- **animate(element, x, y, index)** - `function`: optional.
- **done(nodeList)** - `function`: optional. Callback called after the grid is built. It returns the node list of grid items.

#### `animate`

It returns a function with the `element`,`x`,`y` and `index` parameters for each grid item.

```js
function animate(el, x, y, index) {
  // Use your favourite library for animate the element
}
minigrid('.grid', '.grid-item', 6, animate);
```

## Responsiveness

minigrid is dead-simple and doesn't provide anything in-the-box but you can do:

```js
window.addEventListener('resize', function(){
  minigrid('.grid', '.grid-item');
});
```
<commit_msg>Update README to reflect new first argument<commit_after>![icon](http://alves.im/minigrid/assets/favicon-32x32.png)

Minigrid is a minimal 2kb zero dependency cascading grid layout.

**[Demo](http://alves.im/minigrid/)**

## Install

`npm install minigrid`

Using Bower:

`bower install minigrid`

## Usage

```html
<div class="grid">
  <div class="grid-item"></div>
  <div class="grid-item"></div>
  <div class="grid-item"></div>
  <div class="grid-item"></div>
</div>
```

```js
var grid = require('minigrid');
grid('.grid', '.grid-item');
```

## API

### `minigrid(gridContainer, itemSelector, gutter, animate, done)`

- **gridContainer** - `string`|`node`: required. The element selector or element where your grid items sit.
- **itemSelector** - `string`: required. The grid item element selector.
- **gutter** - `number`: optional. The space between items, the default is `6`.
- **animate(element, x, y, index)** - `function`: optional.
- **done(nodeList)** - `function`: optional. Callback called after the grid is built. It returns the node list of grid items.

#### `animate`

It returns a function with the `element`,`x`,`y` and `index` parameters for each grid item.

```js
function animate(el, x, y, index) {
  // Use your favourite library for animate the element
}
minigrid('.grid', '.grid-item', 6, animate);
```

## Responsiveness

minigrid is dead-simple and doesn't provide anything in-the-box but you can do:

```js
window.addEventListener('resize', function(){
  minigrid('.grid', '.grid-item');
});
```

{'fraction_non_alphanumeric': 0.18172757475083057, 'fraction_numerical': 0.004651162790697674, 'mean_word_length': 4.586270871985158, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3557168', 'n_tokens_mistral': 1022, 'n_tokens_neox': 959, 'n_words': 310}