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

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/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,55 +1,58 @@
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
- - UglifyJS Updated and you can uglify js even es6 sentences! - 2020/11/03
11
- - DevDependencies to Dependencies for this production - 2020/08/26
12
- - changed css option - solved cleancss commentary issue - 2020/08/21
13
- - bug fixed(1.1.7) - solved cleancss first line delete error - 2020/08/21
14
- - added command line execution with 2 parameters
15
- - added exceptFolder parameter - 2020/08/20
16
- - you can use relative path
17
- - bug fixed(1.1.3) - 2020/08/15
18
-
19
- ## Usage
20
-
21
- ```
22
-
23
- npm install uglify-js-minify-css-allfiles
24
-
25
- or
26
-
27
- yarn add uglify-js-minify-css-allfiles
28
- ```
29
-
30
- ```javascript
31
- // index.js
32
- const minifyAll = require('uglify-js-minify-css-allfiles');
33
-
34
- // param1 : Type a path you will change all files inside this path
35
- // param2 : folder or file name you want to take off
36
- // (1)
37
- minifyAll('../test/', 'lib');
38
-
39
- // (2)
40
- minifyAll(process.argv.slice(2)[0], process.argv.slice(2)[1]);
41
- ```
42
-
43
- ## Excute
44
-
45
- ```
46
- (1)
47
- node index.js
48
-
49
- or
50
-
51
- (2)
52
- node index.js folderPath exceptionFolderPath
53
- ```
54
-
55
- <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
+ # 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> -->
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,75 +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).code;
46
- writeFiles(paths, result);
47
- } else if (paths.substr(-4) === DIRECTORY.STYLESHEET) {
48
- result = new cleanCSS(CSSOPTIONS).minify(code).styles;
49
- writeFiles(paths, result);
50
- }
51
- });
52
-
53
- // writeFiles..
54
- function writeFiles(file, value) {
55
- // exception..
56
- if (typeof value == 'undefined' || value === '' || value === null) {
57
- console.error(
58
- '************error file ㅜㅜㅜㅜ***********\n' +
59
- file +
60
- '\n **********ㅗㅗㅗㅗㅗ error file********',
61
- );
62
- errorFilesNumber += 1;
63
- errorFileObjects.push(file);
64
- return;
65
- } else {
66
- console.info(file);
67
- fs.writeFile(file, value, 'utf-8', function (error) {
68
- if (error) return console.error(error);
69
- });
70
- }
71
- }
72
-
73
- console.info('file change ended... \nerrorFilesNumber : ' + errorFilesNumber);
74
- console.info('*******errorFileObjects******* : ' + errorFileObjects);
75
- };
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,45 @@
1
- {
2
- "name": "uglify-js-minify-css-allfiles",
3
- "version": "1.2.6",
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.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
+ }
@@ -0,0 +1 @@
1
+ function dragon(){console.assert("sdsfdsd")}
@@ -0,0 +1 @@
1
+ function dragon(){console.assert("sdsfdsd")}
@@ -0,0 +1 @@
1
+ function dragon(){console.assert("sdsfdsd")}
@@ -0,0 +1 @@
1
+ function dragon(){console.assert("sdsfdsd")}
package/test/lib/comon.js CHANGED
@@ -1,3 +1 @@
1
- function dragon() {
2
- console.log('sdasfasd');
3
- }
1
+ function dragon(){console.assert("sdsfdsd")}
@@ -0,0 +1 @@
1
+ function dragon(){console.assert("sdsfdsd")}
@@ -0,0 +1 @@
1
+ function dragon(){console.assert("sdsfdsd")}
@@ -0,0 +1,19 @@
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
+ }
@@ -0,0 +1 @@
1
+ function dragon(){console.assert("sdsfdsd")}