uglify-js-minify-css-allfiles 1.2.9 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,19 @@
1
+ # Changelog
2
+
3
+ ## v 1.3.2 (2023-05-28)
4
+
5
+ - feature: [Add new `CHANGELOG.md`](/CHANGELOG.md)
6
+ - fix & etc:
7
+ - fix
8
+ - bug fixed(1.1.7) - Solved cleancss first line delete error. - 2020/08/21
9
+ - bug fixed(1.1.3) - ... 2020/08/15
10
+ - etc
11
+ - When CSS Warnings is exist, not minify any code. - 2022/04/13
12
+ - UglifyJS Updated removing 'console.info, console.warn, console.error'. - 2021/11/12
13
+ - UglifyJS Updated working without 'console.log' not console.error, info etc. - 2021/03/17
14
+ - UglifyJS Updated and you can uglify JavaScript files even ES6 sentences! - 2020/11/03
15
+ - Moving DevDependencies to Dependencies for this production. - 2020/08/26
16
+ - Solved cleancss commentary issue because of changed CSS options. - 2020/08/21
17
+ - Add command line execution with 2 parameters.
18
+ - Add the exceptFolder parameter. - 2020/08/20
19
+ - You can use relative path.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2020 NOEL <copstyle86@gmail.com>
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1
+ MIT License
2
+
3
+ Copyright (c) 2020 NOEL <copstyle86@gmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
package/README.md CHANGED
@@ -1,58 +1,80 @@
1
- # uglify-js and minify-css allFiles
2
-
3
- - you will be able to minify all files as same file names which is js or css
4
- - you are able to minify all files in a specific folder.
5
- - you can do this easily via `demo.js` file in `node_modules/uglify-js-minify-css-allfiles`
6
- - if you have a question or some problem, contact me anywhen.
7
- - please email me copstyle86@gmail.com or use github issue tab.
8
-
9
- ## History
10
- - When Css Warnings is exist, not minify any code - 2022/04/13
11
- - UglifyJS Updated removing 'console.info, console.warn, console.error'. - 2021/11/12
12
- - UglifyJS Updated working without 'console.log' not console.error, info etc. - 2021/03/17
13
- - UglifyJS Updated and you can uglify js even es6 sentences! - 2020/11/03
14
- - DevDependencies to Dependencies for this production - 2020/08/26
15
- - changed css option - solved cleancss commentary issue - 2020/08/21
16
- - bug fixed(1.1.7) - solved cleancss first line delete error - 2020/08/21
17
- - added command line execution with 2 parameters
18
- - added exceptFolder parameter - 2020/08/20
19
- - you can use relative path
20
- - bug fixed(1.1.3) - 2020/08/15
21
-
22
- ## Usage
23
-
24
- ```
25
-
26
- npm install uglify-js-minify-css-allfiles
27
-
28
- or
29
-
30
- yarn add uglify-js-minify-css-allfiles
31
- ```
32
-
33
- ```javascript
34
- // index.js
35
- const minifyAll = require('uglify-js-minify-css-allfiles');
36
-
37
- // param1 : Type a path you will change all files inside this path
38
- // param2 : folder or file name you want to take off
39
- // (1)
40
- minifyAll('../test/', 'lib');
41
-
42
- // (2)
43
- minifyAll(process.argv.slice(2)[0], process.argv.slice(2)[1]);
44
- ```
45
-
46
- ## Excute
47
-
48
- ```
49
- (1)
50
- node index.js
51
-
52
- or
53
-
54
- (2)
55
- node index.js folderPath exceptionFolderPath
56
- ```
57
- <!--
58
- <a href="https://www.buymeacoffee.com/eYs1lFK" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" ></a> -->
1
+ [![NPM downloads][npm-downloads]][npm-url]
2
+ [![NPM total downloads][npm-total-downloads]][npm-url]
3
+
4
+ | &nbsp;<br>[![Donate][donate-badge]][donate-url] <br>&nbsp; | Your help is appreciated! [Create a PR][create-pr] or just [buy me a coffee][donate-url] |
5
+ | ---------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
6
+
7
+ [npm-url]: https://www.npmjs.com/package/uglify-js-minify-css-allfiles
8
+ [npm-downloads]: https://img.shields.io/npm/dm/uglify-js-minify-css-allfiles.svg
9
+ [npm-total-downloads]: https://img.shields.io/npm/dt/uglify-js-minify-css-allfiles.svg?label=total+downloads
10
+ [donate-badge]: https://img.shields.io/badge/Buy%20me%20a%20coffee-Donate-red.svg
11
+ [donate-url]: https://github.com/sponsors/oinochoe
12
+ [create-pr]: https://github.com/oinochoe/ugly-code/pulls
13
+
14
+ # uglify-js-minify-css-allfiles
15
+
16
+ uglify-js-minify-css-allfiles helps hide the code you don't want to see, obfuscate the code in the deployment environment through a simple CLI in the build environment, and make it less recognizable to others. you can do this easily via `demo.js` file in `node_modules/uglify-js-minify-css-allfiles`. you are able to minify all files in a specific folder.
17
+
18
+ [![NPM](https://nodei.co/npm/uglify-js-minify-css-allfiles.png?downloads=true&stars=true)](https://www.npmjs.com/package/uglify-js-minify-css-allfiles)
19
+
20
+ ---
21
+
22
+ ## Table of Contents
23
+
24
+ - [Installation](#installation)
25
+ - [Examples](#examples)
26
+ - [Changelog](#changelog)
27
+ - [License](#license)
28
+ <!-- - [API](#api)
29
+ - [`Methods`](#methods) -->
30
+
31
+ ## Installation
32
+
33
+ Install with `npm`:
34
+
35
+ ```bash
36
+ $ npm i uglify-js-minify-css-allfiles
37
+ ```
38
+
39
+ ## Examples
40
+
41
+ ```js
42
+ // index.js
43
+ const minifyAll = require('uglify-js-minify-css-allfiles');
44
+
45
+ /**
46
+ * @param1 - Type the folder name you want to change all files inside.
47
+ * @param2 - Type the folder name you never want to change all files inside.
48
+ * @functions - minifyAll(minifyFolder, noMinifyFolder)
49
+ */
50
+
51
+ // Example 1
52
+ minifyAll('../test/', 'lib');
53
+
54
+ // Example 2
55
+ minifyAll(process.argv.slice(2)[0], process.argv.slice(2)[1]);
56
+ ```
57
+
58
+ <!--
59
+ ## API
60
+
61
+ ### `Methods`
62
+
63
+ Create a new progress bar. It's necessary to wait for the [`ready` event](https://github.com/electron/electron/blob/master/docs/api/app.md#event-ready) to be emitted by [Electron's BrowserWindow](https://github.com/electron/electron/blob/master/docs/api/browser-window.md), since the progress bar is displayed within it. Optionally, you can pass the electron app as a second parameter (parameter `electronApp`) when creating the progress bar. Check the sample code on this page for detailed examples on how to set properties to `options`.
64
+
65
+ You can define most of the characteristics of the progress bar using the `options` parameter. Below is a list of properties that you can set for the `options` parameter.
66
+
67
+ | Option name | Type | Default value | Description |
68
+ | ------------ | -------------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
69
+ | debug | <code>boolean</code> | <code>false</code> | Specifies whether debugging should be enabled. If set to `true`, the browser's DevTools panel will automatically open when the progress bar is created. This can be helpful when debugging and/or dealing with issues. |
70
+ | abortOnError | <code>boolean</code> | <code>false</code> | Specifies whether the progress bar should automatically abort and close if an error occurs internally. | -->
71
+
72
+ ---
73
+
74
+ ## Changelog
75
+
76
+ [Changelog](/CHANGELOG.md)
77
+
78
+ ## License
79
+
80
+ MIT. See [LICENSE.md](https://github.com/oinochoe/ugly-code/blob/master/LICENSE) for details.
package/demo.js CHANGED
@@ -1,4 +1,4 @@
1
- const minifyAll = require('./minify.js');
2
- minifyAll('./test/lib');
3
- // console.log(process.argv.slice(2)[0], process.argv.slice(2)[1]);
4
- // minifyAll(process.argv.slice(2)[0], process.argv.slice(2)[1]);
1
+ const minifyAll = require('./minify.js');
2
+ minifyAll('./test/lib');
3
+ // console.log(process.argv.slice(2)[0], process.argv.slice(2)[1]);
4
+ // minifyAll(process.argv.slice(2)[0], process.argv.slice(2)[1]);
package/dist/module.js CHANGED
@@ -1,89 +1,89 @@
1
- /**
2
- * uglify-js and minify-css allFiles
3
- * Released under the terms of MIT license
4
- *
5
- * Copyright (C) 2020 yeongmin
6
- */
7
-
8
- const fs = require('fs');
9
- const path = require('path');
10
- const uglifyJS = require('uglify-js');
11
- const cleanCSS = require('clean-css');
12
- const DIRECTORY = {
13
- JAVASCRIPT: '.js',
14
- STYLESHEET: '.css',
15
- };
16
- const CSSOPTIONS = {
17
- level: { 1: { all: false } },
18
- };
19
- let errorFilesNumber = 0;
20
- let errorFileObjects = [];
21
-
22
- // getFiles..
23
- const getAllFiles = (pathDir, callback) => {
24
- let files = fs.readdirSync(pathDir) || [];
25
- files.forEach((name) => {
26
- let filePath = path.join(pathDir, name);
27
- let fileState = fs.statSync(filePath);
28
- if (fileState.isFile()) {
29
- callback(filePath, fileState);
30
- } else if (fileState.isDirectory()) {
31
- getAllFiles(filePath, callback);
32
- }
33
- });
34
- };
35
-
36
- // minify All Files..
37
- module.exports = async function minifyAll(contentsPath, exceptFolder) {
38
- let CONTENTSDIR = contentsPath || '';
39
- let EXCEPTIONFOLDER = exceptFolder || '';
40
- let result = '';
41
- getAllFiles(CONTENTSDIR, (paths) => {
42
- let code = fs.readFileSync(paths, 'utf-8');
43
- if (EXCEPTIONFOLDER !== '' && paths.includes(EXCEPTIONFOLDER)) return;
44
- if (paths.substr(-3) === DIRECTORY.JAVASCRIPT) {
45
- result = uglifyJS.minify(code, {
46
- compress: {
47
- pure_funcs: ['console.log', 'console.error', 'console.warn', 'console.info'],
48
- },
49
- }).code;
50
- writeFiles(paths, result);
51
- } else if (paths.substr(-4) === DIRECTORY.STYLESHEET) {
52
- new cleanCSS(CSSOPTIONS).minify(code, function (error, output) {
53
- if (0 < output.warnings.length) {
54
- console.error('CSS FILE ERROR!', output.warnings);
55
- writeFiles(paths, null);
56
- return;
57
- } else {
58
- result = new cleanCSS(CSSOPTIONS).minify(code).styles;
59
- writeFiles(paths, result);
60
- }
61
- });
62
- }
63
- });
64
-
65
- // writeFiles..
66
- function writeFiles(file, value) {
67
- // exception..
68
- if (typeof value == 'undefined' || value === '' || value === null) {
69
- console.error(
70
- '************error file ㅜㅜㅜㅜ***********\n' +
71
- file +
72
- '\n **********ㅗㅗㅗㅗㅗ error file********',
73
- );
74
- errorFilesNumber += 1;
75
- errorFileObjects.push(file);
76
- return;
77
- } else {
78
- console.info(file);
79
- fs.writeFile(file, value, 'utf-8', function (error) {
80
- if (error) return console.error(error);
81
- });
82
- }
83
- }
84
-
85
- if (0 < errorFileObjects.length) {
86
- console.info('file change ended... \nerrorFilesNumber : ' + errorFilesNumber);
87
- console.info('*******errorFileObjects******* : ' + errorFileObjects);
88
- }
89
- };
1
+ /**
2
+ * uglify-js and minify-css allFiles
3
+ * Released under the terms of MIT license
4
+ *
5
+ * Copyright (C) 2020 yeongmin
6
+ */
7
+
8
+ const fs = require('fs');
9
+ const path = require('path');
10
+ const uglifyJS = require('uglify-js');
11
+ const cleanCSS = require('clean-css');
12
+ const DIRECTORY = {
13
+ JAVASCRIPT: '.js',
14
+ STYLESHEET: '.css',
15
+ };
16
+ const CSSOPTIONS = {
17
+ level: { 1: { all: false } },
18
+ };
19
+ let errorFilesNumber = 0;
20
+ let errorFileObjects = [];
21
+
22
+ // getFiles..
23
+ const getAllFiles = (pathDir, callback) => {
24
+ let files = fs.readdirSync(pathDir) || [];
25
+ files.forEach((name) => {
26
+ let filePath = path.join(pathDir, name);
27
+ let fileState = fs.statSync(filePath);
28
+ if (fileState.isFile()) {
29
+ callback(filePath, fileState);
30
+ } else if (fileState.isDirectory()) {
31
+ getAllFiles(filePath, callback);
32
+ }
33
+ });
34
+ };
35
+
36
+ // minify All Files..
37
+ module.exports = async function minifyAll(contentsPath, exceptFolder) {
38
+ let CONTENTSDIR = contentsPath || '';
39
+ let EXCEPTIONFOLDER = exceptFolder || '';
40
+ let result = '';
41
+ getAllFiles(CONTENTSDIR, (paths) => {
42
+ let code = fs.readFileSync(paths, 'utf-8');
43
+ if (EXCEPTIONFOLDER !== '' && paths.includes(EXCEPTIONFOLDER)) return;
44
+ if (paths.substr(-3) === DIRECTORY.JAVASCRIPT) {
45
+ result = uglifyJS.minify(code, {
46
+ compress: {
47
+ pure_funcs: ['console.log', 'console.error', 'console.warn', 'console.info'],
48
+ },
49
+ }).code;
50
+ writeFiles(paths, result);
51
+ } else if (paths.substr(-4) === DIRECTORY.STYLESHEET) {
52
+ new cleanCSS(CSSOPTIONS).minify(code, function (error, output) {
53
+ if (0 < output.warnings.length) {
54
+ console.error('CSS FILE ERROR!', output.warnings);
55
+ writeFiles(paths, null);
56
+ return;
57
+ } else {
58
+ result = new cleanCSS(CSSOPTIONS).minify(code).styles;
59
+ writeFiles(paths, result);
60
+ }
61
+ });
62
+ }
63
+ });
64
+
65
+ // writeFiles..
66
+ function writeFiles(file, value) {
67
+ // exception..
68
+ if (typeof value == 'undefined' || value === '' || value === null) {
69
+ console.error(
70
+ '************error file ㅜㅜㅜㅜ***********\n' +
71
+ file +
72
+ '\n **********ㅗㅗㅗㅗㅗ error file********',
73
+ );
74
+ errorFilesNumber += 1;
75
+ errorFileObjects.push(file);
76
+ return;
77
+ } else {
78
+ console.info(file);
79
+ fs.writeFile(file, value, 'utf-8', function (error) {
80
+ if (error) return console.error(error);
81
+ });
82
+ }
83
+ }
84
+
85
+ if (0 < errorFileObjects.length) {
86
+ console.info('file change ended... \nerrorFilesNumber : ' + errorFilesNumber);
87
+ console.info('*******errorFileObjects******* : ' + errorFileObjects);
88
+ }
89
+ };
package/minify.js CHANGED
@@ -1 +1 @@
1
- module.exports = require('./dist/module');
1
+ module.exports = require('./dist/module');
package/package.json CHANGED
@@ -1,45 +1,46 @@
1
- {
2
- "name": "uglify-js-minify-css-allfiles",
3
- "version": "1.2.9",
4
- "description": "you will be able to minify all files as same file names which is js or css",
5
- "main": "minify.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
8
- },
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/oinochoe/minify_contents.git"
12
- },
13
- "keywords": [
14
- "uglify-js",
15
- "minify-es6",
16
- "uglifyjs-es6",
17
- "uglifyjs2",
18
- "minifycss",
19
- "miniCss",
20
- "cleanCss",
21
- "minifyCss",
22
- "comporessor",
23
- "allfile minify",
24
- "allfiles minify",
25
- "all files uglify"
26
- ],
27
- "author": {
28
- "name": "yeongmin kim",
29
- "email": "copstyle86@gmail.com",
30
- "url": "https://oinochoe.github.io/portfolio/"
31
- },
32
- "license": "MIT",
33
- "bugs": {
34
- "url": "https://github.com/oinochoe/minify_contents/issues",
35
- "email": "copstyle86@gmail.com"
36
- },
37
- "homepage": "https://github.com/oinochoe/minify_contents#readme",
38
- "dependencies": {
39
- "clean-css": "^4.2.3",
40
- "uglify-js-es6": "^2.8.9"
41
- },
42
- "devDependencies": {
43
- "uglify-js": "github:mishoo/UglifyJS2#harmony"
44
- }
45
- }
1
+ {
2
+ "name": "uglify-js-minify-css-allfiles",
3
+ "version": "1.3.1",
4
+ "description": "you will be able to minify all files as same file names which is js or css",
5
+ "main": "minify.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/oinochoe/minify_contents.git"
12
+ },
13
+ "keywords": [
14
+ "ugly-code",
15
+ "uglyCode",
16
+ "uglify-js",
17
+ "minify-es6",
18
+ "uglifyjs-es6",
19
+ "minifycss",
20
+ "miniCss",
21
+ "cleanCss",
22
+ "minifyCss",
23
+ "comporessor",
24
+ "allfile minify",
25
+ "allfiles minify",
26
+ "all files uglify"
27
+ ],
28
+ "author": {
29
+ "name": "yeongmin kim",
30
+ "email": "copstyle86@gmail.com",
31
+ "url": "https://oinochoe.github.io/portfolio/"
32
+ },
33
+ "license": "MIT",
34
+ "bugs": {
35
+ "url": "https://github.com/oinochoe/ugly-code/issues",
36
+ "email": "copstyle86@gmail.com"
37
+ },
38
+ "homepage": "https://github.com/oinochoe/ugly-code#readme",
39
+ "dependencies": {
40
+ "clean-css": "^4.2.3",
41
+ "uglify-js-es6": "^2.8.9"
42
+ },
43
+ "devDependencies": {
44
+ "uglify-js": "github:mishoo/UglifyJS2#harmony"
45
+ }
46
+ }
@@ -1 +0,0 @@
1
- function dragon(){console.assert("sdsfdsd")}
@@ -1 +0,0 @@
1
- function dragon(){console.assert("sdsfdsd")}
@@ -1 +0,0 @@
1
- function dragon(){console.assert("sdsfdsd")}
@@ -1 +0,0 @@
1
- function dragon(){console.assert("sdsfdsd")}
@@ -1 +0,0 @@
1
- function dragon(){console.assert("sdsfdsd")}
@@ -1 +0,0 @@
1
- function dragon(){console.assert("sdsfdsd")}
@@ -1,19 +0,0 @@
1
- @charset "utf-8";
2
- main {
3
- display: block;
4
- font-size: 30px;
5
- -webkit-text-size-adjust: auto;
6
- appearance: none;
7
- }
8
- @keyframes identifier {
9
- 0% {
10
- display: block;
11
- }
12
- 100% {
13
- display: none;
14
- }
15
- }
16
- span {
17
- display: block;
18
- font-size: 50px;
19
- }
@@ -1 +0,0 @@
1
- function dragon(){console.assert("sdsfdsd")}