Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use rollup to bundle. #1496

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

7 changes: 7 additions & 0 deletions index-es.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Sortable from './Sortable';

export default Sortable;

export {
Sortable
}
3 changes: 3 additions & 0 deletions index-iife.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Sortable from './Sortable';

export default Sortable;
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
15 changes: 7 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@
"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",
"module": "index-es.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 <ibnRubaXa@gmail.com>",
Expand Down
13 changes: 13 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import json from 'rollup-plugin-json';

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