Skip to content

Commit

Permalink
bundle.js (uglify-js), bundle.css (clean-css-cli)
Browse files Browse the repository at this point in the history
  • Loading branch information
DarrenSem committed Aug 25, 2023
1 parent 005fdff commit 958746d
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# git CLI
**/*.js.map -diff
**/*.css.map -diff

# GitHub
**/*.js.map linguist-generated=true
**/*.css.map linguist-generated=true
2 changes: 2 additions & 0 deletions dist/bundle.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/bundle.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions dist/bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/bundle.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<title>Math Power!</title>

<link rel="stylesheet" type="text/css" href="./dist/calc.css" />
<link rel="stylesheet" type="text/css" href="./dist/bundle.css" />

</head><body>

Expand Down Expand Up @@ -48,7 +48,6 @@ <h1>Math Power!</h1>
<input type="text" id="result" readonly>
</div>

<script type="text/javascript" src="./dist/calc.js"></script>
<script defer type="text/javascript" src="./dist/browser.js"></script>
<script type="text/javascript" src="./dist/bundle.js"></script>

</body></html>
30 changes: 21 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
{
"name": "math-power",
"version": "1.5.0",
"version": "1.5.1",
"description": "Web app for AWS experimenting via simple math operations",
"main": "index.html",
"scripts": {
"preview": "START \"\" ./index.html",
"clean": "node clean.js",
"copycss": " copy /y \".\\src\\*.css\" \".\\dist\" > NUL || cp \"./src/\"*.css \"./dist\" ",
"gh": " START \"\" /b \"C:\\data\\apps\\git\\gh-pages merge from master.bat\" ",
"watch": "ECHO.Watching from latest build... && pause && tsc --build --watch",
"watch": "tsc --build --watch",

"copy-css": " copy /y \".\\src\\*.css\" \".\\dist\" > NUL || cp \"./src/\"*.css \"./dist\" ",
"compile-css": " npm run copy-css && cleancss --source-map --source-map-inline-sources --output ./dist/bundle.css -- ./dist/calc.css ",
"compile-js": " tsc && uglifyjs --compress --mangle --source-map \"includeSources,url='./bundle.js.map',content=inline\" --output ./dist/bundle.js -- ./dist/calc.js ./dist/browser.js ",

"test": "ECHO.Testing latest build... && node ./dist/calc.test.js",
"build": "ECHO.Starting new build... && npm run clean && tsc && npm run copycss && npm test && ECHO.Build passed tests.",

"min-css": " cleancss --source-map --source-map-inline-sources --output ./dist/bundle.css -- ./dist/calc.css ",
"min-js": " uglifyjs --compress --mangle --source-map \"includeSources,url='./bundle.js.map',content=inline\" --output ./dist/bundle.js -- ./dist/calc.js ./dist/browser.js ",

"build": "ECHO.Starting new build... && node clean.js && npm run compile-css && npm run compile-js && npm test && ECHO.Build compiled and passed tests. && npm run min-css && npm run min-js && ECHO.Build minified -- ready to deploy.",

"preview": "START \"\" ./index.html",
"start": "ECHO.Starting browser with latest build... && npm run preview",

"gh": " START \"\" /b \"C:\\data\\apps\\git\\gh-pages merge from master.bat\" ",
"_publish_git_commands_": "git checkout gh-pages && git merge master && git push origin gh-pages && git checkout -",
"publish": "ECHO.Publishing latest build... && npm test && npm run gh . && git checkout - && ECHO.DONE."
"publish": "ECHO.Publishing latest build... && npm test && npm run gh . && git checkout - && ECHO.DONE."
},
"keywords": [
"AWS",
Expand All @@ -34,6 +43,9 @@
"devDependencies": {
"@types/node": "^20.5.3",
"ts-node": "^10.9.1",
"typescript": "^5.1.6"
"typescript": "^5.1.6",
"uglify-js": "^3.17.4",
"clean-css": "^5.3.2",
"clean-css-cli": "^5.6.2"
}
}

0 comments on commit 958746d

Please sign in to comment.