Skip to content

Commit 3430c8b

Browse files
Merge pull request #129 from pradipchaudhary/project98
init basic minification and bundling app [project98]
2 parents a75fe93 + b3f3c29 commit 3430c8b

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<link rel="stylesheet" href="styles.css" />
7+
<title>Minification and Bundling App</title>
8+
</head>
9+
<body>
10+
<div class="container">
11+
<h1>Minification and Bundling App</h1>
12+
<textarea
13+
id="inputCode"
14+
placeholder="Paste your code here..."
15+
></textarea>
16+
<button onclick="minifyAndBundle()">Minify and Bundle</button>
17+
<div id="outputCode"></div>
18+
</div>
19+
20+
<script src="script.js"></script>
21+
</body>
22+
</html>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
function minifyAndBundle() {
2+
const inputCode = document.getElementById("inputCode").value;
3+
4+
if (!inputCode.trim()) {
5+
alert("Please enter code to minify and bundle.");
6+
return;
7+
}
8+
9+
// In a real-world scenario, you might use a library or an API for minification and bundling.
10+
// Here, we'll simply use a placeholder to demonstrate the process.
11+
const minifiedCode = minifyCode(inputCode);
12+
const bundledCode = bundleCode(minifiedCode);
13+
14+
displayResult(bundledCode);
15+
}
16+
17+
function minifyCode(code) {
18+
// Placeholder for minification logic
19+
return code.replace(/\s/g, ""); // Remove whitespaces
20+
}
21+
22+
function bundleCode(code) {
23+
// Placeholder for bundling logic
24+
return `(function(){${code}})();`; // Wrap code in an IIFE (Immediately Invoked Function Expression)
25+
}
26+
27+
function displayResult(result) {
28+
const outputCode = document.getElementById("outputCode");
29+
outputCode.textContent = result;
30+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
body {
2+
font-family: Arial, sans-serif;
3+
display: flex;
4+
align-items: center;
5+
justify-content: center;
6+
height: 100vh;
7+
margin: 0;
8+
}
9+
10+
.container {
11+
text-align: center;
12+
}
13+
14+
textarea {
15+
width: 100%;
16+
height: 150px;
17+
margin: 10px 0;
18+
}
19+
20+
button {
21+
padding: 10px 20px;
22+
font-size: 16px;
23+
margin: 10px;
24+
}
25+
26+
#outputCode {
27+
margin-top: 20px;
28+
font-size: 18px;
29+
}

0 commit comments

Comments
 (0)