Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
MattIPv4 committed Jul 22, 2020
1 parent 4f04ca5 commit e1a9f97
Show file tree
Hide file tree
Showing 18 changed files with 246 additions and 11 deletions.
9 changes: 1 addition & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
# Minify Tool
# JavaScript Minify Tool

A web tool for the DigitalOcean Community to quickly minify JavaScript files.

---

## TODO

- Add new section below config with educational content
- Explain why minification is useful
- Explain the basics of using Terser in a production workflow
- Move to do-community

## Development/Building

To setup the build/develop environment, you will need to run `npm ci` with Node 12+ installed. This
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
"url": "git+https://github.com/do-community/minify-tool.git"
},
"keywords": [
"minfiy"
"minfiy",
"javascript",
"terser"
],
"author": "DigitalOcean",
"bugs": {
Expand Down
16 changes: 16 additions & 0 deletions src/minify-tool/data/example_code.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2020 DigitalOcean
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

export default `/* This a top-level function with some arguments that should be mangled */
const test = (argumentOne, argumentTwo) => {
Expand Down
16 changes: 16 additions & 0 deletions src/minify-tool/data/terser/base.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2020 DigitalOcean
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

export default `// Import Terser so we can use it
const Terser = require('terser');
Expand Down
16 changes: 16 additions & 0 deletions src/minify-tool/data/terser/normal_usage.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2020 DigitalOcean
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import base from './base';

export default `${base}
Expand Down
16 changes: 16 additions & 0 deletions src/minify-tool/data/terser/sourcemap_usage.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2020 DigitalOcean
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import base from './base';

export default `${base}
Expand Down
16 changes: 16 additions & 0 deletions src/minify-tool/i18n/en/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2020 DigitalOcean
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import templates from './templates';

export default { templates };
18 changes: 17 additions & 1 deletion src/minify-tool/i18n/en/templates/app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
/*
Copyright 2020 DigitalOcean
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

export default {
title: 'Minify Tool',
title: 'JavaScript Minify Tool',
description: 'A web tool for the DigitalOcean Community to quickly minify JavaScript files.',
liveCompression: 'Enable live compression as you type',
compress: 'Compress Code',
Expand Down
16 changes: 16 additions & 0 deletions src/minify-tool/i18n/en/templates/config/compress.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2020 DigitalOcean
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

export default {
compress: 'Compress',
compressDesc: 'Compress the output script',
Expand Down
16 changes: 16 additions & 0 deletions src/minify-tool/i18n/en/templates/config/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2020 DigitalOcean
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import compress from './compress';
import mangle from './mangle';

Expand Down
16 changes: 16 additions & 0 deletions src/minify-tool/i18n/en/templates/config/mangle.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2020 DigitalOcean
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

export default {
mangle: 'Mangle',
mangleDesc: 'Mangle variable names within the script',
Expand Down
16 changes: 16 additions & 0 deletions src/minify-tool/i18n/en/templates/explainer.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2020 DigitalOcean
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

export default {
whyMinifyYourJavaScript: 'Why minify your JavaScript?',
whyMinifyYourJavaScriptContent: [
Expand Down
16 changes: 16 additions & 0 deletions src/minify-tool/i18n/en/templates/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2020 DigitalOcean
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import app from './app';
import config from './config';
import explainer from './explainer';
Expand Down
16 changes: 16 additions & 0 deletions src/minify-tool/i18n/en/templates/size.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2020 DigitalOcean
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

export default {
codeSize: 'Code Size',
before: 'Before:',
Expand Down
16 changes: 16 additions & 0 deletions src/minify-tool/i18n/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2020 DigitalOcean
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import en from './en';

const lang = 'en';
Expand Down
2 changes: 1 addition & 1 deletion src/minify-tool/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
-->

<extends src="../build/base.html">
<block name="title">Minify Tool | </block>
<block name="title">JavaScript Minify Tool | </block>
<block name="head">
<link rel="stylesheet" href="scss/style.scss">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css" integrity="sha256-UzFD2WYH2U1dQpKDjjZK72VtPeWP50NoJjd26rnAdUI=" crossorigin="anonymous" />
Expand Down
16 changes: 16 additions & 0 deletions src/minify-tool/templates/explainer.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
<!--
Copyright 2020 DigitalOcean

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<template>
<div class="explainer">
<h3>{{ i18n.templates.explainer.whyMinifyYourJavaScript }}</h3>
Expand Down
16 changes: 16 additions & 0 deletions src/minify-tool/templates/size.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
<!--
Copyright 2020 DigitalOcean

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<template>
<div class="size">
<h4>{{ i18n.templates.size.codeSize }}</h4>
Expand Down

1 comment on commit e1a9f97

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been deployed to DigitalOcean Spaces for easy reviewing.

minify-tool

Please sign in to comment.