Skip to content

Commit 1163e1f

Browse files
Merge pull request #19 from MiguelCastillo/pakit-build
introducing pakit build to generate minified assets
2 parents d5d3cbc + 9dcfe51 commit 1163e1f

5 files changed

Lines changed: 40 additions & 16 deletions

File tree

.eslintrc.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
module.exports = {
2+
"parserOptions": {
3+
"sourceType": "module"
4+
},
5+
"env": {
6+
"browser": true,
7+
"commonjs": true
8+
},
9+
"rules": {
10+
"curly": 2,
11+
"no-console": 0,
12+
"no-debugger": 2,
13+
"no-alert": 2,
14+
"no-use-before-define": 0,
15+
"no-underscore-dangle": 0,
16+
"no-multi-spaces": 0,
17+
"no-unused-vars": 1,
18+
"semi": 0,
19+
"global-strict": 0,
20+
"wrap-iife": [2, "inside"],
21+
"quotes": [1, "double"],
22+
"key-spacing": 0,
23+
"no-trailing-spaces": 0,
24+
"eol-last": 2
25+
}
26+
};

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,5 @@ node_modules
3131

3232
# Optional REPL history
3333
.node_repl_history
34+
index.js.map
35+
index.js

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.travis.yml

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"name": "load-js",
33
"version": "2.0.0",
44
"description": "Promise based script loader for the browser using script tags",
5-
"main": "index.js",
5+
"main": "src/load-js.js",
66
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
7+
"prepublish": "pakit src/load-js.js --out index.js --umd loadJS"
88
},
99
"repository": {
1010
"type": "git",
@@ -15,5 +15,8 @@
1515
"bugs": {
1616
"url": "https://github.com/MiguelCastillo/load-js/issues"
1717
},
18-
"homepage": "https://github.com/MiguelCastillo/load-js"
18+
"homepage": "https://github.com/MiguelCastillo/load-js",
19+
"devDependencies": {
20+
"pakit": "^0.6.1"
21+
}
1922
}

index.js renamed to src/load-js.js

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
1-
(function(global, factory) {
2-
if (typeof require === "function" && typeof exports === "object" && typeof module === "object") {
3-
// CommonJS support
4-
module.exports = factory();
5-
} else if (typeof define === "function" && define.amd) {
6-
// Do AMD support
7-
define(["loadJS"], factory);
8-
} else {
9-
// Do browser support
10-
global.loadJS = factory();
11-
}
12-
})(this, function() {
1+
function createLoadJS() {
132
var cache = {};
143
var head = document.getElementsByTagName("head")[0] || document.documentElement;
154

@@ -129,4 +118,7 @@
129118
Promise.all(items.map(exec)) :
130119
exec(items);
131120
}
132-
});
121+
}
122+
123+
module.exports = createLoadJS();
124+
module.exports.create = createLoadJS;

0 commit comments

Comments
 (0)