add build

This commit is contained in:
s2
2019-04-15 11:34:09 +02:00
parent 9d3cd7ec4f
commit 224b6828c7
2948 changed files with 348000 additions and 35 deletions

14
node_modules/minifyfromhtml/.editorconfig generated vendored Normal file
View File

@@ -0,0 +1,14 @@
# Editor configuration, see http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = tab
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf
[*.md]
max_line_length = off
trim_trailing_whitespace = false

33
node_modules/minifyfromhtml/.eslintrc.json generated vendored Normal file
View File

@@ -0,0 +1,33 @@
{"parserOptions":
{"ecmaVersion": 6},
"rules": {
"quotes": [2, "single", {"allowTemplateLiterals": true}],
"curly": [2, "all"],
"keyword-spacing": [2, {"overrides": {"else": {"before": true}, "catch": {"before": true, "after": false}}}],
"space-before-blocks": [2, "always"],
"wrap-iife": [2, "inside"],
"space-before-function-paren": [2, "never"],
"one-var": [2, "never"],
"vars-on-top": 0, "no-empty": [2, {"allowEmptyCatch": true}],
"array-bracket-spacing": [2, "never"],
"space-in-parens": [2, "never"],
"no-underscore-dangle": 0,
"comma-style": [2, "last"],
"comma-spacing": [2, {"before": false, "after": true}],
"space-unary-ops": [2, {"words": false, "nonwords": false}],
"no-multi-spaces": 2,
"space-infix-ops": 2,
"no-with": 2,
"indent": [2, "tab", {"SwitchCase": 1, "FunctionExpression": {"body": 1, "parameters": 1}, "MemberExpression": 0}],
"no-mixed-spaces-and-tabs": 2,
"no-trailing-spaces": 2,
"comma-dangle": [2, "never"],
"semi": [2, "always"],
"brace-style": [2, "1tbs", {"allowSingleLine": true}],
"eol-last": 2,
"dot-notation": 0,
"no-multi-str": 2,
"key-spacing": [2, {"afterColon": true}],
"func-call-spacing": [2, "never"]
}
}

25
node_modules/minifyfromhtml/.vscode/launch.json generated vendored Normal file
View File

@@ -0,0 +1,25 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach to Remote",
"address": "127.0.0.1",
"port": 9229,
"localRoot": "${workspaceFolder}",
"remoteRoot": "${workspaceFolder}"
},
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}\\minifyfromhtml.js",
"args": ["--js=../dist/mywidget.min.js", "--css=../dist/mywidget.min.css", "< index.html"],
"cwd": "${workspaceFolder}\\example"
}
]
}

3
node_modules/minifyfromhtml/.vscode/settings.json generated vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"git.ignoreLimitWarning": true
}

13
node_modules/minifyfromhtml/README.md generated vendored Normal file
View File

@@ -0,0 +1,13 @@
# minifyfromhtml
This little helper minifies scripts and css starting from an html file. I made it after asking this question on stackoverflow: https://stackoverflow.com/questions/50188269/minify-js-and-css-in-one-go-starting-from-html/
It takes an input html file, parses it, and outputs all included javascript and css files minified to a file you specify:
```
minifyfromhtml --js=<output js file> --css=<output css file> < <input file>
```
example:
```
minifyfromhtml --js=dist/mywidget.min.js --css=dist/mywidget.min.css < example/index.html
```

3
node_modules/minifyfromhtml/example/css/mywidget.css generated vendored Normal file
View File

@@ -0,0 +1,3 @@
#mywidget {
border: 2px solid red;
}

28
node_modules/minifyfromhtml/example/index.html generated vendored Normal file
View File

@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Example</title>
<!-- jquery is not used in this example, it's just here to demo the compression -->
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
<!-- the widget -->
<script type="text/javascript" charset="utf-8" src="js/spectacularwidget.js"></script>
<!-- some css -->
<link rel="stylesheet" type="text/css" href="css/mywidget.css" />
</head>
<body>
<div id="mywidget"></div>
<script>
//widget init
spectacularwidget(document.getElementById('mywidget'));
</script>
</body>
</html>

10364
node_modules/minifyfromhtml/example/js/jquery.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,5 @@
var spectacularwidget = function(me) {
me.innerHTML = 'this is so spectacular!';
};
window.spectacularwidget = spectacularwidget;

135
node_modules/minifyfromhtml/minifyfromhtml.js generated vendored Normal file
View File

@@ -0,0 +1,135 @@
let argv = require('minimist')(process.argv.slice(2));
let fs = require('fs');
let path = require('path');
let jsdom = require('jsdom');
let JSDOM = jsdom.JSDOM;
let minify = require('minify');
let usage = `usage:
minifyfromhtml --js=<output js file> --css=<output css file> --exclude=<exclude files> < <input file>
the minification process uses minify under the hood.
http://coderaiser.github.io/minify/
example:
minifyfromhtml --js=dist/mywidget.min.js --css=dist/mywidget.min.css --exclude=js/jquery.js < example/index.html
`;
if (argv.h) {
console.log(usage);
return;
}
if (!argv.js || !argv.css) {
console.log(usage);
return;
}
var excludeFiles = argv.exclude || [];
if (typeof(excludeFiles) === 'string') {
excludeFiles = [excludeFiles];
}
let readStdin = function(cb) {
let stdin = '';
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', function(buf) {
stdin += buf;
});
process.stdin.on('end', function() {
cb(stdin);
});
}
readStdin(function(html) {
let dom = new JSDOM(html);
let getTagAttrs = function(dom, tag, attr) {
let scripts = [];
let document = dom.window.document;
let scriptTags = document.getElementsByTagName(tag);
let i = scriptTags.length;
for (let i = 0; i < scriptTags.length; i++) {
let src = scriptTags[i].getAttribute(attr);
if (src) {
scripts.push(src);
}
}
return scripts;
}
//process scripts
let scripts = getTagAttrs(dom, 'script', 'src');
//remove exluded
excludeFiles.forEach(i => {
var index = scripts.indexOf(i);
if (index !== -1) {
scripts.splice(index, 1);
}
});
let processedScripts = {};
for (let i = 0; i < scripts.length; i++) {
let script = scripts[i];
minify(script, 'stream')
.then(function(data) {
processedScripts[script] = data;
if (Object.keys(processedScripts).length === scripts.length) {
//write scripts
//clear out dist file
fs.writeFileSync(argv.js, '');
//write files
for (let i = 0; i < scripts.length; i++) {
const script = scripts[i];
console.log(script + ' -> ' + argv.js);
fs.appendFileSync(argv.js, processedScripts[script] + '\n');
}
}
});
}
//process css
let styles = getTagAttrs(dom, 'link', 'href');
//remove exluded
excludeFiles.forEach(i => {
var index = styles.indexOf(i);
if (index !== -1) {
styles.splice(index, 1);
}
});
let processedStyles = {};
fs.writeFileSync(argv.css, '');
for (let i = 0; i < styles.length; i++) {
let style = styles[i];
minify(style, 'stream')
.then(function(data) {
processedStyles[style] = data;
if (Object.keys(processedStyles).length === styles.length) {
//write styles
//clear out dist file
fs.writeFileSync(argv.css, '');
//write files
for (let i = 0; i < styles.length; i++) {
const style = styles[i];
console.log(style + ' -> ' + argv.css);
fs.appendFileSync(argv.css, processedStyles[style] + '\n');
}
}
});
}
});

52
node_modules/minifyfromhtml/package.json generated vendored Normal file
View File

@@ -0,0 +1,52 @@
{
"_from": "git+https://github.com/S2-/minifyfromhtml.git#semver:1.x",
"_id": "minifyfromhtml@1.1.0",
"_inBundle": false,
"_integrity": "",
"_location": "/minifyfromhtml",
"_phantomChildren": {},
"_requested": {
"type": "git",
"raw": "minifyfromhtml@git+https://github.com/S2-/minifyfromhtml.git#semver:1.x",
"name": "minifyfromhtml",
"escapedName": "minifyfromhtml",
"rawSpec": "git+https://github.com/S2-/minifyfromhtml.git#semver:1.x",
"saveSpec": "git+https://github.com/S2-/minifyfromhtml.git#semver:1.x",
"fetchSpec": "https://github.com/S2-/minifyfromhtml.git",
"gitRange": "1.x",
"gitCommittish": null
},
"_requiredBy": [
"#DEV:/"
],
"_resolved": "git+https://github.com/S2-/minifyfromhtml.git#9aa30e929e5ea539f4d0dff0cf6858174039e21f",
"_spec": "minifyfromhtml@git+https://github.com/S2-/minifyfromhtml.git#semver:1.x",
"_where": "F:\\projects\\vanillajs-seed",
"author": "",
"bin": {
"minifyfromhtml": "./minifyfromhtml.js"
},
"bugs": {
"url": "https://github.com/S2-/minifyfromhtml/issues"
},
"bundleDependencies": false,
"dependencies": {
"jsdom": "^14.0.0",
"minify": "^4.1.1",
"minimist": "^1.2.0"
},
"deprecated": false,
"description": "minify scripts and css starting from an html file",
"homepage": "https://github.com/S2-/minifyfromhtml#readme",
"license": "ISC",
"main": "minifyfromhtml.js",
"name": "minifyfromhtml",
"repository": {
"type": "git",
"url": "git+https://github.com/S2-/minifyfromhtml.git"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"version": "1.1.0"
}