Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Niklas Rämö committed Sep 29, 2018
2 parents 1d072a4 + cba33c9 commit e40391e
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 74 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Muuri

[![gzip size](http://img.badgesize.io/https://unpkg.com/[email protected].0/dist/muuri.min.js?compression=gzip)](https://unpkg.com/[email protected].0/dist/muuri.min.js)
[![gzip size](http://img.badgesize.io/https://unpkg.com/[email protected].1/dist/muuri.min.js?compression=gzip)](https://unpkg.com/[email protected].1/dist/muuri.min.js)
[![npm](https://img.shields.io/npm/v/muuri.svg)](http://npm.im/muuri)

Muuri is a JavaScript layout engine that allows you to build all kinds of layouts and make them responsive, sortable, filterable, draggable and/or animated. Comparing to what's out there Muuri is a combination of [Packery](http://packery.metafizzy.co/), [Masonry](http://masonry.desandro.com/), [Isotope](http://isotope.metafizzy.co/) and [Sortable](https://github.com/RubaXa/Sortable). Wanna see it in action? Check out the [demo](http://haltu.github.io/muuri/) on the website.
Expand Down Expand Up @@ -35,13 +35,13 @@ Muuri uses [Web Animations](https://developer.mozilla.org/en-US/docs/Web/API/Web
### 1. Get Muuri

Download:
* [muuri.js](https://unpkg.com/[email protected].0/dist/muuri.js) - for development (not minified, with comments).
* [muuri.min.js](https://unpkg.com/[email protected].0/dist/muuri.min.js) - for production (minified, no comments).
* [muuri.js](https://unpkg.com/[email protected].1/dist/muuri.js) - for development (not minified, with comments).
* [muuri.min.js](https://unpkg.com/[email protected].1/dist/muuri.min.js) - for production (minified, no comments).

Or link directly:

```html
<script src="https://unpkg.com/[email protected].0/dist/muuri.min.js"></script>
<script src="https://unpkg.com/[email protected].1/dist/muuri.min.js"></script>
```

Or install with [npm](https://www.npmjs.com/):
Expand All @@ -67,7 +67,7 @@ Add Muuri on your site and make sure to include the optional dependencies (if ne
```html
<script src="https://unpkg.com/[email protected]/web-animations.min.js"></script>
<script src="https://unpkg.com/[email protected]/hammer.min.js"></script>
<script src="https://unpkg.com/[email protected].0/dist/muuri.min.js"></script>
<script src="https://unpkg.com/[email protected].1/dist/muuri.min.js"></script>
```

### 4. Add the markup
Expand Down
18 changes: 10 additions & 8 deletions dist/muuri.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

/**
* Muuri v0.7.0
* Muuri v0.7.1
* https://github.com/haltu/muuri
* Copyright (c) 2015-present, Haltu Oy
* Released under the MIT license
Expand All @@ -17,12 +16,15 @@
*/

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('hammerjs')) :
typeof define === 'function' && define.amd ? define(['hammerjs'], factory) :
(global.Muuri = factory(global.Hammer));
}(this, (function (Hammer) { 'use strict';

Hammer = Hammer && Hammer.hasOwnProperty('default') ? Hammer['default'] : Hammer;
if (typeof exports === 'object' && typeof module !== 'undefined') {
var Hammer;
try { Hammer = require('hammerjs') } catch (e) {}
module.exports = factory(Hammer);
} else {
global.Muuri = factory(global.Hammer);
}
}(this, (function (Hammer) {
'use strict';

var namespace = 'Muuri';
var gridInstances = {};
Expand Down
4 changes: 2 additions & 2 deletions dist/muuri.min.js

Large diffs are not rendered by default.

43 changes: 43 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,23 @@ const size = require('gulp-size');
const rimraf = require('rimraf');
const argv = require('yargs').argv;
const dotenv = require('dotenv');
const replace = require('gulp-replace');
const exec = require('child_process').exec;

const pkg = require('./package.json');
const karmaDefaults = require('./karma.defaults.js');

const patchedUMD = `(function (global, factory) {
if (typeof exports === 'object' && typeof module !== 'undefined') {
var Hammer;
try { Hammer = require('hammerjs') } catch (e) {}
module.exports = factory(Hammer);
} else {
global.Muuri = factory(global.Hammer);
}
}(this, (function (Hammer) {
'use strict';`;

if (fs.existsSync('./.env')) dotenv.load();

gulp.task('lint', () => {
Expand Down Expand Up @@ -157,6 +169,37 @@ gulp.task('format-test', cb => {
});
});

gulp.task('bundle', cb => {
exec('npm run bundle', (err, stdout, stderr) => {
console.log(stdout);
console.log(stderr);
cb(err);
});
});

gulp.task('fix-umd', () => {
const mainPath = './' + pkg.main;
return gulp
.src(mainPath, { base: './' })
.pipe(replace(/\(function([\s\S]*?)Hammer;/, patchedUMD))
.pipe(gulp.dest('./'));
});

gulp.task('minify', cb => {
exec('npm run minify', (err, stdout, stderr) => {
console.log(stdout);
console.log(stderr);
cb(err);
});
});

gulp.task(
'build',
gulp.series('bundle', 'fix-umd', 'minify', done => {
done();
})
);

gulp.task(
'pre-commit',
gulp.series('lint', 'format-test', done => {
Expand Down
81 changes: 48 additions & 33 deletions package-lock.json

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

9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "muuri",
"version": "0.7.0",
"version": "0.7.1",
"description": "Responsive, sortable, filterable and draggable grid layouts.",
"keywords": [
"grid",
Expand Down Expand Up @@ -28,7 +28,9 @@
"test-sauce-min": "./node_modules/.bin/gulp test-sauce-min",
"test-local": "./node_modules/.bin/gulp test-local",
"test-local-min": "./node_modules/.bin/gulp test-local-min",
"build": "./node_modules/.bin/rollup -c",
"bundle": "./node_modules/.bin/rollup -c",
"minify": "./node_modules/.bin/terser ./dist/muuri.js -o ./dist/muuri.min.js -c -m --comments",
"build": "./node_modules/.bin/gulp build",
"lint": "./node_modules/.bin/gulp lint",
"format": "./node_modules/.bin/prettier --write ./src/**/*.js",
"format-test": "./node_modules/.bin/prettier --list-different ./src/**/*.js",
Expand All @@ -47,6 +49,7 @@
"dotenv": "^6.0.0",
"gulp": "^4.0.0",
"gulp-eslint": "^5.0.0",
"gulp-replace": "^1.0.0",
"gulp-size": "^3.0.0",
"hammerjs": "^2.0.8",
"husky": "^1.0.0-rc.13",
Expand All @@ -67,7 +70,7 @@
"rollup-plugin-commonjs": "^9.1.8",
"rollup-plugin-node-resolve": "^3.4.0",
"rollup-plugin-strip-banner": "^0.2.0",
"rollup-plugin-terser": "^3.0.0",
"terser": "^3.8.2",
"web-animations-js": "^2.3.1",
"yargs": "^12.0.2"
}
Expand Down
24 changes: 1 addition & 23 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import { terser } from 'rollup-plugin-terser';
import stripBanner from 'rollup-plugin-strip-banner';
import pkg from './package.json';

const banner = `
/**
const banner = `/**
* Muuri v${pkg.version}
* ${pkg.homepage}
* Copyright (c) 2015-present, Haltu Oy
Expand Down Expand Up @@ -35,25 +33,5 @@ export default [
banner: banner
},
plugins: [resolve(), commonjs(), stripBanner()]
},
{
external: ['hammerjs'],
input: 'src/index.js',
output: {
name: 'Muuri',
file: pkg.main.replace('.js', '.min.js'),
format: 'umd',
globals: { hammerjs: 'Hammer' },
banner: banner
},
plugins: [
resolve(),
commonjs(),
terser({
output: {
comments: 'some'
}
})
]
}
];

0 comments on commit e40391e

Please sign in to comment.