Skip to content

Commit

Permalink
Use rollup to bundle.
Browse files Browse the repository at this point in the history
  • Loading branch information
garygreen committed Apr 20, 2019
1 parent 2f00519 commit 460411e
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 74 deletions.
26 changes: 6 additions & 20 deletions Sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,12 @@
* @license MIT
*/

(function sortableModule(factory) {
"use strict";
"use strict";

if (typeof define === "function" && define.amd) {
define(factory);
}
else if (typeof module != "undefined" && typeof module.exports != "undefined") {
module.exports = factory();
}
else {
/* jshint sub:true */
window["Sortable"] = factory();
}
})(function sortableFactory() {
"use strict";
import { version } from './package.json';

if (typeof window === "undefined" || !window.document) {
return function sortableError() {
throw new Error("Sortable.js requires a window with a document");
};
throw new Error("Sortable.js requires a window with a document");
}

var dragEl,
Expand Down Expand Up @@ -2455,6 +2441,6 @@


// Export
Sortable.version = '1.9.0';
return Sortable;
});
Sortable.version = version;

export default Sortable;
45 changes: 0 additions & 45 deletions gulpfile.js

This file was deleted.

2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ <h3 class="col-6"><a target="_blank" href="https://github.com/SortableJS/polymer


<!-- Latest Sortable -->
<script src="./Sortable.js"></script>
<script src="dist/sortable.js"></script>

<script type="text/javascript" src="st/prettify/prettify.js"></script>
<script type="text/javascript" src="st/prettify/run_prettify.js"></script>
Expand Down
14 changes: 6 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@
"exportName": "Sortable",
"version": "1.9.0",
"devDependencies": {
"gulp": "^4.0.0",
"gulp-each": "^0.5.0",
"gulp-rename": "^1.4.0",
"gulp-uglify": "^3.0.1",
"http-server": "^0.9.0",
"pump": "^3.0.0"
"rollup": "^1.10.1",
"uglify-js": "^3.5.5"
},
"description": "JavaScript library for reorderable drag-and-drop lists on modern browsers and touch devices. No jQuery required. Supports Meteor, AngularJS, React, Polymer, Vue, Knockout and any CSS library, e.g. Bootstrap.",
"main": "Sortable.js",
"scripts": {
"http-server": "http-server -s ./",
"prepublish": "gulp build"
"prepublish": "npm run build",
"build": "rollup -c rollup.config.js && npm run min",
"min": "uglifyjs -mangle --comments=/@license/ -o dist/sortable.min.js -- dist/sortable.js",
"watch": "npm run build -- --watch"
},
"maintainers": [
"Konstantin Lebedev <[email protected]>",
Expand Down
11 changes: 11 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import json from 'rollup-plugin-json';

export default {
input: 'Sortable.js',
output: {
file: 'dist/sortable.js',
format: 'iife',
name: 'Sortable'
},
plugins: [json()]
};

0 comments on commit 460411e

Please sign in to comment.