Skip to content

szymonszoldra/MiniPy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MiniPy

Simple JavaScript minifier written in Python. It removes every unnecessary whitespace character, and minify everything to one-line file.

How to use

Copy main.py file to directory with your JavaScript files

In terminal enter

python main.py file_name.js

You can enter multiple files names

python main.py first.js second.js third.js

It will make directory "minified" with all your files

Example console output

output

Example file

Input:

const inputs = [...document.querySelectorAll('.controls input')];
const root = document.documentElement;

function changeStyle(e) {
  if (e.target.name === 'base') {
    return root.style.setProperty(`--${e.target.name}`, `${e.target.value}`);
  }
  root.style.setProperty(`--${e.target.name}`, `${e.target.value}px`);
}

inputs.forEach(input => input.addEventListener('input', (e) => changeStyle(e)));

Output:

const inputs=[...document.querySelectorAll('.controls input')];const root=document.documentElement;function changeStyle(e){if(e.target.name==='base'){return root.style.setProperty(`--${e.target.name}`,`${e.target.value}`);}root.style.setProperty(`--${e.target.name}`,`${e.target.value}px`);}inputs.forEach(input=>input.addEventListener('input',(e)=>changeStyle(e)));

About

Simple JavaScript minifier written in Python.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages