Skip to content
Merged
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
22 changes: 22 additions & 0 deletions 98-Minification and Bundling/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="styles.css" />
<title>Minification and Bundling App</title>
</head>
<body>
<div class="container">
<h1>Minification and Bundling App</h1>
<textarea
id="inputCode"
placeholder="Paste your code here..."
></textarea>
<button onclick="minifyAndBundle()">Minify and Bundle</button>
<div id="outputCode"></div>
</div>

<script src="script.js"></script>
</body>
</html>
30 changes: 30 additions & 0 deletions 98-Minification and Bundling/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
function minifyAndBundle() {
const inputCode = document.getElementById("inputCode").value;

if (!inputCode.trim()) {
alert("Please enter code to minify and bundle.");
return;
}

// In a real-world scenario, you might use a library or an API for minification and bundling.
// Here, we'll simply use a placeholder to demonstrate the process.
const minifiedCode = minifyCode(inputCode);
const bundledCode = bundleCode(minifiedCode);

displayResult(bundledCode);
}

function minifyCode(code) {
// Placeholder for minification logic
return code.replace(/\s/g, ""); // Remove whitespaces
}

function bundleCode(code) {
// Placeholder for bundling logic
return `(function(){${code}})();`; // Wrap code in an IIFE (Immediately Invoked Function Expression)
}

function displayResult(result) {
const outputCode = document.getElementById("outputCode");
outputCode.textContent = result;
}
29 changes: 29 additions & 0 deletions 98-Minification and Bundling/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
body {
font-family: Arial, sans-serif;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
}

.container {
text-align: center;
}

textarea {
width: 100%;
height: 150px;
margin: 10px 0;
}

button {
padding: 10px 20px;
font-size: 16px;
margin: 10px;
}

#outputCode {
margin-top: 20px;
font-size: 18px;
}