├── .eslintrc.js ├── .github ├── ISSUE_TEMPLATE │ ├── help.md │ ├── report-a-bug.md │ └── request-a-feature.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── do-spaces-workflow.yml │ ├── gh-pages-workflow.yml │ └── test-workflow.yml ├── .gitignore ├── .nvmrc ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── package-lock.json ├── package.json ├── posthtml.config.js └── src ├── minify-tool ├── data │ ├── example_code.js │ └── terser │ │ ├── base.js │ │ ├── normal_usage.js │ │ └── sourcemap_usage.js ├── i18n │ ├── en │ │ ├── index.js │ │ └── templates │ │ │ ├── app.js │ │ │ ├── config │ │ │ ├── compress.js │ │ │ ├── index.js │ │ │ └── mangle.js │ │ │ ├── explainer.js │ │ │ ├── index.js │ │ │ └── size.js │ └── index.js ├── index.html ├── mount.js ├── scss │ ├── _code.scss │ ├── _fields.scss │ ├── _pretty-checkbox.scss │ ├── _vue-prism-editor.scss │ ├── _vue-select.scss │ ├── prism │ │ ├── _font-fix.scss │ │ ├── _prism-fix.scss │ │ └── _token-fix.scss │ └── style.scss └── templates │ ├── app.vue │ ├── config.vue │ ├── config │ ├── compress.vue │ └── mangle.vue │ ├── explainer.vue │ ├── output.vue │ ├── size.vue │ └── sourcemap.vue └── static ├── minify-tool-banner.png ├── minify-tool-banner.svg ├── minify-tool.png ├── minify-tool.svg └── robots.txt /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | 'browser': true, 4 | 'node': true 5 | }, 6 | extends: [ 7 | 'eslint:recommended', 8 | 'plugin:vue/recommended', 9 | ], 10 | parserOptions: { 11 | ecmaVersion: 2018, 12 | sourceType: 'module', 13 | }, 14 | rules: { 15 | 'linebreak-style': ['error', 'unix'], 16 | semi: ['error', 'always'], 17 | quotes: ['error', 'single'], 18 | 'comma-dangle': ['error', 'always-multiline'], 19 | 'vue/require-v-for-key': 0, 20 | 'vue/require-default-prop': 0, 21 | 'vue/no-v-html': 0, 22 | 'vue/valid-v-for': 0, 23 | 'vue/max-attributes-per-line': 0, 24 | 'vue/html-indent': ['error', 4], 25 | 'vue/script-indent': ['error', 4, { 26 | baseIndent: 1, 27 | }], 28 | 'vue/no-unused-vars': 0, 29 | 'vue/html-self-closing': 0, 30 | 'vue/multi-word-component-names': 0, 31 | 'vue/no-reserved-component-names': 0, 32 | }, 33 | }; 34 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/help.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Help ❓ 3 | about: Encountered a problem with the tool? 4 | --- 5 | 6 | 15 | 16 | ## Information 17 | 19 | 20 | ## Help request 21 | 22 | ### Problem 23 | 24 | 25 | ### What I have tried 26 | 27 | 28 | ### Screenshots 29 | 30 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/report-a-bug.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Report a bug 🐛 3 | about: Report a bug with the tool. Only use this if you're 100% sure there's something wrong, otherwise, try "Help". 4 | --- 5 | 6 | 19 | 20 | ## Information 21 | 23 | 24 | ## Details 25 | 26 | ### Description 27 | 28 | 29 | ### Steps to reproduce 30 | 31 | 32 | ### Expected behavior 33 | 34 | 35 | ### Screenshots 36 | 37 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/request-a-feature.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Request a feature 🆕 3 | about: Suggest a new feature that you would like in the tool! 4 | --- 5 | 6 | 31 | 32 | ## Feature request 33 | 34 | ### Feature description 35 | 36 | 37 | ### How the feature is useful 38 | 39 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Type of Change 2 | 3 | 4 | - **Build Scripts:** 5 | - **Tool Source:** 6 | - **Something else:** 7 | 8 | ## What issue does this relate to? 9 | 10 | 11 | ### What should this PR do? 12 | 13 | 14 | ### What are the acceptance criteria? 15 | 16 | 17 | -------------------------------------------------------------------------------- /.github/workflows/do-spaces-workflow.yml: -------------------------------------------------------------------------------- 1 | name: Deploy to DigitalOcean Spaces 2 | 3 | on: push 4 | 5 | permissions: 6 | contents: write 7 | 8 | jobs: 9 | deploy-spaces: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Checkout 14 | uses: actions/checkout@v3 15 | 16 | - name: Use Node.js 17 | uses: actions/setup-node@v3 18 | with: 19 | node-version-file: .nvmrc 20 | cache: npm 21 | 22 | - name: Install dependencies, test, and build 23 | run: | 24 | npm ci 25 | npm test 26 | npm run build 27 | 28 | - name: Deploy commit to DigitalOcean Spaces 29 | run: aws s3 sync ./dist s3://${{ secrets.SPACES_BUCKET }}/commits/minify-tool/${{ github.sha }} --endpoint=https://${{ secrets.SPACES_REGION }}.digitaloceanspaces.com --acl public-read --content-encoding utf8 30 | env: 31 | AWS_ACCESS_KEY_ID: ${{ secrets.SPACES_ACCESS_KEY_ID }} 32 | AWS_SECRET_ACCESS_KEY: ${{ secrets.SPACES_SECRET_ACCESS_KEY }} 33 | AWS_DEFAULT_REGION: ${{ secrets.SPACES_REGION }} 34 | 35 | - name: Leave a comment on commit 36 | run: npm run deploy:spaces:comment 37 | env: 38 | REPO_NAME: ${{ github.repository }} 39 | COMMIT_SHA: ${{ github.sha }} 40 | GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} 41 | SPACES_REGION: ${{ secrets.SPACES_REGION }} 42 | SPACES_BUCKET: ${{ secrets.SPACES_BUCKET }} 43 | -------------------------------------------------------------------------------- /.github/workflows/gh-pages-workflow.yml: -------------------------------------------------------------------------------- 1 | name: Deploy to GitHub Pages 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | permissions: 9 | contents: write 10 | 11 | concurrency: 12 | group: gh-pages-workflow 13 | cancel-in-progress: true 14 | 15 | jobs: 16 | deploy-pages: 17 | runs-on: ubuntu-latest 18 | 19 | steps: 20 | - name: Checkout 21 | uses: actions/checkout@v3 22 | 23 | - name: Use Node.js 24 | uses: actions/setup-node@v3 25 | with: 26 | node-version-file: .nvmrc 27 | cache: npm 28 | 29 | - name: Install dependencies, test, and build 30 | run: | 31 | npm ci 32 | npm test 33 | npm run build 34 | 35 | - name: Deploy master to GitHub Pages 36 | uses: JamesIves/github-pages-deploy-action@v4 37 | with: 38 | folder: dist 39 | clean: true 40 | single-commit: true 41 | -------------------------------------------------------------------------------- /.github/workflows/test-workflow.yml: -------------------------------------------------------------------------------- 1 | name: Test and Build 2 | 3 | on: pull_request 4 | 5 | permissions: 6 | contents: read 7 | 8 | jobs: 9 | test-build: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Checkout 14 | uses: actions/checkout@v3 15 | 16 | - name: Use Node.js 17 | uses: actions/setup-node@v3 18 | with: 19 | node-version-file: .nvmrc 20 | cache: npm 21 | 22 | - name: Install dependencies 23 | run: npm ci 24 | 25 | - name: Run tests 26 | run: npm test 27 | 28 | - name: Build tool 29 | run: npm run build 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .cache/ 3 | dist/ 4 | dev/ 5 | .idea/ 6 | .vscode/ 7 | build/base.html 8 | build/svg/ 9 | .DS_Store 10 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | v20.9.0 2 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | ## Pull Requests 4 | 5 | ### Creating a Pull Request 6 | 7 | This application has been designed so that people can easily expand it. 8 | To request us to review code that you create, you will need to create a pull request. 9 | Creating a pull request is described in 10 | [this tutorial](https://www.digitalocean.com/community/tutorials/how-to-create-a-pull-request-on-github). 11 | 12 | ### Linting 13 | 14 | Before creating a pull request to this application, you will want to lint it first. 15 | This is because linting is a check that is ran when a pull request is made and cannot be merged in if it fails. 16 | 17 | To lint, simply run `npm test`. This will lint all the JS, Vue & SCSS files within the app. 18 | 19 | If there are any errors that can be automatically be fixed with the files, you can execute 20 | `npm run test:fix` to automatically do that. 21 | 22 | This project enforces LF line styles, 4 spaces, semi-colons and dangling commas. 23 | The linting will fail if this is not followed. 24 | 25 | ### File Location/Types 26 | 27 | Please see [README: Source Structure](README.md#source-structure) for information on how files should be organised. 28 | 29 | ## Issue Creation 30 | 31 | In the event that you have a issue using the tool or have a suggest for a change but don't want to contribute code, 32 | we are more than happy to help. 33 | Make sure that when you create your issue, it follows the format for the type of issue you select 34 | (it has individual templates for each issue type). 35 | 36 | Issue template types include the following: 37 | - Bug Reporting 38 | - Feature Requests 39 | - Help Requests 40 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2019 DigitalOcean 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JavaScript Minify Tool 2 | 3 | A web tool for the DigitalOcean Community to quickly minify JavaScript files. 4 | 5 | --- 6 | 7 | ## Development/Building 8 | 9 | To setup the build/develop environment, you will need to run `npm ci` with Node 12+ installed. This 10 | will install the dependencies to allow you to build the project, following our lockfile. 11 | 12 | To develop for this tool run `npm run dev`. 13 | This will start a development server that will automatically reload the codebase when changes occur. 14 | 15 | If you wish to host this tool on a service, simply run `npm run build`. This will run all the 16 | necessary build scripts automatically to build the tool.\ 17 | You can then take the `dist` folder and put it on your web server/bucket. 18 | 19 | GitHub Actions is setup to do this automatically for this repository to deploy to gh-pages. 20 | 21 | ## Source Structure 22 | 23 | ### [`src/minify-tool`](src/minify-tool) 24 | 25 | #### [`src/minify-tool/scss`](src/minify-tool/scss) 26 | 27 | The scss directory contains the main SCSS styling file for the tool, which imports our do-bulma 28 | library and then adds tool-specific customisations. 29 | 30 | #### [`src/minify-tool/templates`](src/minify-tool/templates) 31 | 32 | This directory contains the Vue templates that are used to render the tool on the client-side. 33 | `app.vue` is the main Vue file that other templates are referenced into. 34 | 35 | #### [`src/minify-tool/i18n`](src/minify-tool/i18n) 36 | 37 | All the strings for the tool are housed in this directory, with a file structure similar to the 38 | structure of the templates directory. 39 | 40 | ## Contributing 41 | 42 | If you are contributing, please read the [contributing file](CONTRIBUTING.md) before submitting your pull requests. 43 | 44 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "minify-tool", 3 | "version": "1.0.0", 4 | "description": "A web tool for the DigitalOcean Community to quickly minify JavaScript files.", 5 | "license": "Apache-2.0", 6 | "private": true, 7 | "engines": { 8 | "node": "20.9.0" 9 | }, 10 | "scripts": { 11 | "build": "npm run build:clean && npm run build:template && npm run build:static && npm run build:tool", 12 | "build:clean": "do-vue clean", 13 | "build:template": "do-vue template", 14 | "build:static": "copyfiles --up 2 ./src/static/{*,**/*} dist", 15 | "build:tool": "do-vue tool src/minify-tool dist", 16 | "dev": "npm run dev:prep && do-vue dev ./src/minify-tool dev 8000", 17 | "deploy:spaces:comment": "do-vue comment minify-tool", 18 | "dev:prep": "npm run build:template && npm run dev:static", 19 | "dev:static": "copyfiles --up 2 ./src/static/{*,**/*} dev", 20 | "test": "npm run test:eslint && npm run test:scss", 21 | "test:fix": "npm run test:eslint:fix", 22 | "test:eslint": "eslint 'src/**/*.{js,vue}'", 23 | "test:eslint:fix": "npm run test:eslint -- --fix", 24 | "test:scss": "stylelint ./src/**/*.scss --config node_modules/do-bulma/.stylelintrc.json" 25 | }, 26 | "repository": { 27 | "type": "git", 28 | "url": "git+https://github.com/do-community/minify-tool.git" 29 | }, 30 | "keywords": [ 31 | "minfiy", 32 | "javascript", 33 | "terser" 34 | ], 35 | "author": "DigitalOcean", 36 | "bugs": { 37 | "url": "https://github.com/do-community/minify-tool/issues" 38 | }, 39 | "homepage": "https://github.com/do-community/minify-tool#readme", 40 | "dependencies": { 41 | "clone": "^2.1.2", 42 | "do-bulma": "github:do-community/do-bulma", 43 | "do-vue": "github:do-community/do-vue", 44 | "pretty-bytes": "^6.1.1", 45 | "pretty-checkbox-vue": "^1.1.9", 46 | "prismjs": "^1.29.0", 47 | "stringify-object": "^5.0.0", 48 | "terser": "^5.27.0", 49 | "utf8-byte-length": "^1.0.4", 50 | "vue": "^3.4.15", 51 | "vue-prism-editor": "^2.0.0-alpha.2", 52 | "vue-select": "^4.0.0-beta.6", 53 | "vue-tippy": "^6.4.1" 54 | }, 55 | "devDependencies": { 56 | "copyfiles": "^2.4.1", 57 | "eslint": "^8.56.0", 58 | "eslint-plugin-vue": "^9.20.1", 59 | "posthtml": "^0.16.6", 60 | "posthtml-extend": "^0.6.5", 61 | "sass": "^1.70.0", 62 | "stylelint": "^16.2.0", 63 | "stylelint-config-standard-scss": "^13.0.0", 64 | "stylelint-order": "^6.0.4", 65 | "vue-template-compiler": "^2.7.16" 66 | }, 67 | "overrides": { 68 | "do-vue": { 69 | "pretty-checkbox-vue": { 70 | "vue": "^3.0.0" 71 | } 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /posthtml.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "plugins": { 3 | "posthtml-extend": { 4 | "root": "./src" 5 | }, 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/minify-tool/data/example_code.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 DigitalOcean 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | export default `/* This a top-level function with some arguments that should be mangled */ 18 | const test = (argumentOne, argumentTwo) => { 19 | 20 | /* This is an unused function that compression should remove as dead code */ 21 | const hello = () => console.log('hello world'); 22 | 23 | /* Use the input arguments, which should match the new mangled names */ 24 | console.log(argumentOne, argumentTwo); 25 | };`; 26 | -------------------------------------------------------------------------------- /src/minify-tool/data/terser/base.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 DigitalOcean 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | export default `// Import Terser so we can use it 18 | const { minify } = require('terser'); 19 | 20 | // Import fs so we can read/write files 21 | const fs = require('fs'); 22 | 23 | // Define the config for how Terser should minify the code 24 | // This is set to how you currently have this web tool configured 25 | const config = {{CONFIG}}; 26 | 27 | // Load in your code to minify 28 | const code = fs.readFileSync('my_code.js', 'utf8'); 29 | 30 | // Minify the code with Terser 31 | const minified = await minify(code, config);`; 32 | -------------------------------------------------------------------------------- /src/minify-tool/data/terser/normal_usage.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 DigitalOcean 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | import base from './base'; 18 | 19 | export default `${base} 20 | 21 | // Save the code! 22 | fs.writeFileSync('my_code.min.js', minified.code);`; 23 | -------------------------------------------------------------------------------- /src/minify-tool/data/terser/sourcemap_usage.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 DigitalOcean 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | import base from './base'; 18 | 19 | export default `${base} 20 | 21 | // Save the code! 22 | fs.writeFileSync('{{FILE}}', minified.code); 23 | 24 | // Save the generated sourcemap 25 | fs.writeFileSync('{{FILE}}.map', minified.map);`; 26 | -------------------------------------------------------------------------------- /src/minify-tool/i18n/en/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 DigitalOcean 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | import templates from './templates'; 18 | 19 | export default { templates }; 20 | -------------------------------------------------------------------------------- /src/minify-tool/i18n/en/templates/app.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 DigitalOcean 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | export default { 18 | title: 'JavaScript Minify Tool', 19 | description: 'A web tool for the DigitalOcean Community to quickly minify JavaScript files.', 20 | liveCompression: 'Enable live compression as you type', 21 | compress: 'Compress Code', 22 | input: 'Input JavaScript', 23 | errors: 'Errors', 24 | warnings: 'Warnings', 25 | output: 'Output JavaScript', 26 | map: 'Source Map', 27 | mapTitle: 'Generated Source Map', 28 | errorMsg: 'An error occurred during minification', 29 | warningMsg: 'A warning was generated during the minification', 30 | warningsMsg: 'Some warnings were generated during the minification', 31 | oss: 'This tool is {link|open-source on GitHub|https://github.com/do-community/minify-tool} under the {link|Apache-2.0|https://github.com/do-community/minify-tool/blob/master/LICENSE} license! We welcome feedback and contributions.', 32 | }; 33 | -------------------------------------------------------------------------------- /src/minify-tool/i18n/en/templates/config/compress.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 DigitalOcean 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | export default { 18 | compress: 'Compress', 19 | compressDesc: 'Compress the output script', 20 | deadCodeDesc: 'Remove unreachable code from the script', 21 | dropConsoleDesc: 'Remove calls to console.* from the script', 22 | dropDebuggerDesc: 'Remove calls to debugger from the script', 23 | keepClassnamesDesc: 'Preserve unused classes in the script', 24 | keepFargsDesc: 'Preserve unused arguments within functions', 25 | keepFnamesDesc: 'Preserve unused functions in the script', 26 | keepInfinityDesc: 'Preserve `Infinity` usage, instead of replacing it with `1/0`', 27 | }; 28 | -------------------------------------------------------------------------------- /src/minify-tool/i18n/en/templates/config/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 DigitalOcean 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | import compress from './compress'; 18 | import mangle from './mangle'; 19 | 20 | export default { 21 | terserDefaultsPreset: 'Use the default options for Terser, which will mangle the code but not remove unused code', 22 | compressionPreset: 'Enable compression with Terser defaults, mangling and removing any unused code', 23 | safeCompressionPreset: 'Enable compression, but preserve functions and classes from being mangled or removed', 24 | module: 'Module', 25 | moduleDesc: 'Enable if you are minifying an ES6 module', 26 | filename: 'File name', 27 | filenameDesc: 'Provide a filename for your output script to enable source map generation', 28 | comments: 'Comments', 29 | commentsRemove: 'Remove all comments', 30 | commentsPreserve: 'Preserve JSDoc @preserve and @license comments', 31 | commentsKeep: 'Keep all comments', 32 | compress, 33 | mangle, 34 | }; 35 | -------------------------------------------------------------------------------- /src/minify-tool/i18n/en/templates/config/mangle.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 DigitalOcean 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | export default { 18 | mangle: 'Mangle', 19 | mangleDesc: 'Mangle variable names within the script', 20 | evalDesc: 'Mangle variable names within `eval` scopes', 21 | classnamesDesc: 'Enable to preserve class names and not mangle them', 22 | fnamesDesc: 'Enable to preserve function names and not mangle them', 23 | toplevelDesc: 'Enable to mangle names within the top-level scope', 24 | safari10Desc: 'Enable to work around a Safari 10 iterator bug', 25 | }; 26 | -------------------------------------------------------------------------------- /src/minify-tool/i18n/en/templates/explainer.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 DigitalOcean 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | export default { 18 | whyMinifyYourJavaScript: 'Why minify your JavaScript?', 19 | whyMinifyYourJavaScriptContent: [ 20 | 'Minifying, or minification, is where you remove unnecessary characters from your code, whether they might be whitespace (such as indentation), code that isn\'t ever used, comments in your code or long names for variables that can be replaced with something shorter.', 21 | 'Minification of your code results in it taking up less space, making it faster to send from a server to a client, as well as using less bandwidth in doing so. This improves the user experience on your site as it can load faster.', 22 | 'You should only minify the code that you are distributing though, not your source version that you are writing, as minified code is harder to read and understand, making debugging more complicated. Providing a source map helps with this, as it maps the minified code back to the original source code, allowing production errors to be mapped to the correct bit of code in the source version.', 23 | ], 24 | usingTerserInAProductionPipeline: 'Using Terser in a production pipeline', 25 | usingTerserInAProductionPipelineContent: [ 26 | 'There are many different options available for minifying your code in a production workflow, such as uglify-js or minify, but Terser seems to be the most popular tool currently available, as it is able to handle both ES5 & ES6 syntax out of the box.', 27 | 'Terser is available on NPM, and can be installed in your project with `npm install terser`. Optionally, you can install it globally on your machine by adding the `-g` flag to the command, allowing the CLI to be used anywhere and the module to be included in any project.', 28 | 'Once installed, there are two main ways to interact with Terser. Either, you can use the command line interface (CLI) via your terminal/console, or you can use the Terser JavaScript API which allows for more fine control over how your code is minified.', 29 | 'To minify a file with Terser via the CLI, you can run `terser my_code.js --output my_file.min.js`. Compression and mangling can be enabled with the `--compress` and `--mangle` flags respectively. Sourcemap generation can also be enabled with the `--source-map` flag. An example of how to minify your code using the Terser JavaScript API is included below.', 30 | ], 31 | forMoreInformationPleaseSee: 'For more information on using the Terser CLI & API, please see', 32 | theirDocumentationOnGitHub: 'their documentation on GitHub.', 33 | exampleUsageForTerser: 'Example usage for Terser with your current config', 34 | }; 35 | -------------------------------------------------------------------------------- /src/minify-tool/i18n/en/templates/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 DigitalOcean 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | import app from './app'; 18 | import config from './config'; 19 | import explainer from './explainer'; 20 | import size from './size'; 21 | 22 | export default { app, config, explainer, size }; 23 | -------------------------------------------------------------------------------- /src/minify-tool/i18n/en/templates/size.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 DigitalOcean 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | export default { 18 | codeSize: 'Code Size', 19 | before: 'Before:', 20 | after: 'After:', 21 | saving: 'Saving:', 22 | }; 23 | -------------------------------------------------------------------------------- /src/minify-tool/i18n/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 DigitalOcean 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | import en from './en'; 18 | 19 | const lang = 'en'; 20 | const packs = { en }; 21 | 22 | export default packs[lang]; 23 | -------------------------------------------------------------------------------- /src/minify-tool/index.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | JavaScript Minify Tool | DigitalOcean 19 | 20 | 21 | 22 |
23 | 24 |
25 |
26 | -------------------------------------------------------------------------------- /src/minify-tool/mount.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2022 DigitalOcean 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Load in the app 18 | import './scss/style'; 19 | import 'vue-select/dist/vue-select.css'; 20 | import { createApp } from 'vue'; 21 | import App from './templates/app.vue'; 22 | import i18n from './i18n'; 23 | 24 | // Mount the app 25 | document.head.title = i18n.templates.app.title; 26 | createApp(App).mount('#app'); 27 | -------------------------------------------------------------------------------- /src/minify-tool/scss/_code.scss: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2022 DigitalOcean 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Prism itself (output) 18 | pre { 19 | &[class*="language-"] { 20 | padding: .5rem 1rem; 21 | 22 | code { 23 | &[class*="language-"] { 24 | @import "prism/prism-fix"; 25 | } 26 | } 27 | } 28 | } 29 | 30 | // Toolbar on output 31 | .code-toolbar { 32 | > .toolbar { 33 | right: calc(.2em + 16px); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/minify-tool/scss/_fields.scss: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 DigitalOcean 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | .field { 18 | &.is-horizontal { 19 | align-items: center; 20 | 21 | &.is-aligned-top { 22 | align-items: flex-start; 23 | } 24 | 25 | + .control { 26 | margin-top: .5rem; 27 | } 28 | } 29 | 30 | label { 31 | @include font-medium; 32 | 33 | color: $dark-blue; 34 | font-size: 1rem; 35 | 36 | &.text { 37 | border-radius: $border-radius; 38 | color: $dark-grey; 39 | display: inline-block; 40 | font-size: 14px; 41 | padding: 0 .5rem; 42 | } 43 | } 44 | } 45 | 46 | .field-body { 47 | &.is-vertical { 48 | flex-direction: column; 49 | 50 | > .field { 51 | &:not(:last-child) { 52 | margin-bottom: .75rem; 53 | } 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/minify-tool/scss/_pretty-checkbox.scss: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2022 DigitalOcean 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | $pretty--color-dark: $primary; // stylelint-disable-line scss/dollar-variable-pattern 18 | $pretty--color-default: $primary; // stylelint-disable-line scss/dollar-variable-pattern 19 | 20 | @import "~pretty-checkbox/src/pretty-checkbox"; 21 | 22 | .checkbox { 23 | border-radius: $border-radius; 24 | padding: .25rem .5rem; 25 | 26 | .pretty { 27 | &.p-icon { 28 | font-size: 18px; 29 | margin: 0; 30 | 31 | .state { 32 | .icon { 33 | &::before { 34 | color: $panel; 35 | font-size: 14px; 36 | } 37 | } 38 | 39 | label { 40 | color: $dark-grey; 41 | font-size: 14px; 42 | padding-left: calc(#{$margin * .5} + 1.5em); 43 | text-indent: initial; 44 | 45 | &::before, 46 | &::after { 47 | font-size: 18px; 48 | } 49 | } 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/minify-tool/scss/_vue-prism-editor.scss: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2022 DigitalOcean 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // stylelint-disable no-duplicate-at-import-rules, selector-class-pattern 18 | .editor { 19 | background: #fafafa; 20 | border: $thin-border; 21 | border-radius: $border-radius; 22 | padding: .5rem 1rem; 23 | 24 | .prism-editor-wrapper { 25 | .prism-editor__container { 26 | .prism-editor__textarea { 27 | @import "prism/font-fix"; 28 | 29 | &, 30 | &:focus { 31 | background: none; 32 | } 33 | } 34 | 35 | .prism-editor__editor { 36 | @import "prism/prism-fix"; 37 | } 38 | } 39 | } 40 | } 41 | // stylelint-enable no-duplicate-at-import-rules, selector-class-pattern 42 | -------------------------------------------------------------------------------- /src/minify-tool/scss/_vue-select.scss: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2022 DigitalOcean 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // stylelint-disable selector-class-pattern 18 | .v-select { 19 | --vs-border-color: #{$border}; 20 | --vs-border-radius: #{$border-radius}; 21 | --vs-dropdown-box-shadow: 0 2px 4px #{rgba($dark-blue, .06)}; 22 | --vs-dropdown-option--active-bg: #{$primary}; // stylelint-disable-line custom-property-pattern 23 | 24 | &.vs--open { 25 | > ul { 26 | opacity: 1; 27 | } 28 | 29 | .vs__dropdown-toggle { 30 | border-color: $primary; 31 | box-shadow: 0 0 2px rgba($success, .5); 32 | 33 | .vs__selected { 34 | top: .75em; 35 | } 36 | } 37 | } 38 | 39 | > ul { 40 | display: block !important; 41 | margin: 0; 42 | opacity: 0; 43 | transition: opacity $transition; 44 | } 45 | 46 | .vs__dropdown-toggle { 47 | box-shadow: none; 48 | padding: 0 16px; 49 | transition: border $transition, box-shadow $transition; 50 | 51 | .vs__selected-options { 52 | padding: 0; 53 | 54 | .vs__selected { 55 | margin: 0; 56 | padding: 0; 57 | transition: opacity $transition; 58 | } 59 | 60 | .vs__search { 61 | &, 62 | &:focus { 63 | background: none; 64 | border: 0; 65 | box-shadow: none; 66 | margin: 0; 67 | padding: 0; 68 | width: 0; 69 | } 70 | } 71 | } 72 | 73 | .vs__actions { 74 | padding: 0; 75 | } 76 | } 77 | } 78 | // stylelint-enable selector-class-pattern 79 | -------------------------------------------------------------------------------- /src/minify-tool/scss/prism/_font-fix.scss: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 DigitalOcean 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | & { 18 | font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace; 19 | font-size: 13.6px; 20 | font-weight: normal; 21 | line-height: 1.4em; 22 | } 23 | -------------------------------------------------------------------------------- /src/minify-tool/scss/prism/_prism-fix.scss: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2022 DigitalOcean 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | &, 18 | .token { 19 | @import "font-fix"; 20 | } 21 | 22 | @import "token-fix"; 23 | -------------------------------------------------------------------------------- /src/minify-tool/scss/prism/_token-fix.scss: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 DigitalOcean 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | .token { 18 | // Soft-wrap each line 19 | white-space: normal; 20 | word-break: break-all; 21 | word-wrap: anywhere; 22 | 23 | // Fix Bulma & DO Prism styles interfering with default Prism 24 | &.number, 25 | &.tag, 26 | &.entity, 27 | &.operator, 28 | &.url { 29 | background: transparent; 30 | border-radius: initial; 31 | display: initial; 32 | font-size: inherit; 33 | margin: initial; 34 | padding: initial; 35 | text-align: initial; 36 | vertical-align: initial; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/minify-tool/scss/style.scss: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2022 DigitalOcean 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // stylelint-disable-next-line import-notation 18 | @import url("https://assets.digitalocean.com/prism/prism.css"); 19 | 20 | $header: #0071fe; 21 | 22 | @import "~do-bulma/src/style"; 23 | @import "~bulma/sass/utilities/initial-variables"; 24 | @import "~tippy.js/dist/tippy.css"; 25 | @import "~vue-prism-editor/dist/prismeditor.min.css"; 26 | 27 | .do-bulma { 28 | @import "fields"; 29 | @import "pretty-checkbox"; 30 | @import "vue-select"; 31 | @import "vue-prism-editor"; 32 | @import "code"; 33 | 34 | .header { 35 | padding: ($margin * 3.75) 0 0; 36 | 37 | .checkbox { 38 | .pretty { 39 | &.p-icon { 40 | .state { 41 | label { 42 | font-size: 18px; 43 | } 44 | } 45 | } 46 | } 47 | } 48 | } 49 | 50 | .container { 51 | width: 100%; 52 | } 53 | 54 | .actions, 55 | .tabs { 56 | height: $margin * 4; 57 | 58 | @media screen and (max-width: $desktop - 1px) { 59 | height: auto; 60 | } 61 | } 62 | 63 | .tabs { 64 | ul { 65 | align-items: flex-end; 66 | } 67 | } 68 | 69 | .actions { 70 | align-items: center; 71 | display: flex; 72 | flex-direction: row; 73 | 74 | @media screen and (max-width: $desktop - 1px) { 75 | align-items: flex-start; 76 | flex-direction: column; 77 | } 78 | 79 | .checkbox { 80 | margin: 0 0 0 auto; 81 | 82 | @media screen and (max-width: $desktop - 1px) { 83 | margin: .75rem .25rem; 84 | } 85 | } 86 | } 87 | 88 | .size { 89 | h4 { 90 | margin: 1.5rem 0 .5rem; 91 | } 92 | 93 | .data { 94 | display: flex; 95 | flex-flow: row wrap; 96 | 97 | p { 98 | color: $text; 99 | margin: .1rem 0 0; 100 | padding: 0; 101 | 102 | &:not(:first-child) { 103 | border-left: 1px solid $dark-blue; 104 | margin: .1rem 0 0 .5rem; 105 | padding: 0 0 0 .5rem; 106 | } 107 | 108 | b { 109 | color: $dark-blue; 110 | 111 | &.has-text-success { 112 | color: $secondary; 113 | } 114 | 115 | &.has-text-warning { 116 | color: $warning; 117 | } 118 | 119 | &.has-text-danger { 120 | color: $danger; 121 | } 122 | } 123 | } 124 | } 125 | } 126 | 127 | .config { 128 | margin: 1.5rem 0 0; 129 | 130 | .presets { 131 | .control { 132 | &:first-child { 133 | margin-left: 10%; 134 | 135 | @media screen and (max-width: $desktop - 1px) { 136 | margin-left: 0; 137 | } 138 | } 139 | } 140 | } 141 | } 142 | 143 | .explainer { 144 | margin: 2.5rem 0 0; 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /src/minify-tool/templates/app.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 105 | 106 | 220 | -------------------------------------------------------------------------------- /src/minify-tool/templates/config.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 112 | 113 | 258 | -------------------------------------------------------------------------------- /src/minify-tool/templates/config/compress.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 180 | 181 | 241 | -------------------------------------------------------------------------------- /src/minify-tool/templates/config/mangle.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 141 | 142 | 200 | -------------------------------------------------------------------------------- /src/minify-tool/templates/explainer.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 45 | 46 | 93 | -------------------------------------------------------------------------------- /src/minify-tool/templates/output.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 20 | 21 | 36 | -------------------------------------------------------------------------------- /src/minify-tool/templates/size.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 38 | 39 | 79 | -------------------------------------------------------------------------------- /src/minify-tool/templates/sourcemap.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 20 | 21 | 37 | -------------------------------------------------------------------------------- /src/static/minify-tool-banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/do-community/minify-tool/d5a0ce8e65da6f8959756f8de739c077a48dc33d/src/static/minify-tool-banner.png -------------------------------------------------------------------------------- /src/static/minify-tool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/do-community/minify-tool/d5a0ce8e65da6f8959756f8de739c077a48dc33d/src/static/minify-tool.png -------------------------------------------------------------------------------- /src/static/minify-tool.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/static/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: / 3 | --------------------------------------------------------------------------------