How do I make .min files?

Asked 1 years ago, Updated 1 years ago, 51 views

Files with .min such as jQuery and Bootstrap are written in a tight package without any space or comment, but how do I create such a file?

javascript html css

2022-09-30 19:46

6 Answers

It's a file mini-ify.
There are many online services.
http://www.webworkersclip.com/2578/
http://javascript-minifier.com/

You can also automate it by integrating it into the grant (in the grant-contrib-uglify section).
http://qiita.com/bps/items/a8dac15c764d9dfca354


2022-09-30 19:46

I use a tool called Minifier or Uglifier.

Grunt plug-ins manufactured by NodeJS include grunt-contrib-uglify.

There is also a web service with similar features.
Example: http://minify.avivo.si/ #results


2022-09-30 19:46

With Mac, there is a desktop application that can mini-ify JavaScript.Codekit is famous, but a free app called Prepros sounds good. (I've never used either of them, so I don't know how to use them…)

Some text editors have a mini-ify function or plug-in.SublimeText seems to have a plug-in.

Just one second!Easy way to compress and shape CSS/JavaScript with Sublime Text | Web Design Workbook http://webdesign-workbook.com/sublime-text-compress-css-js/


2022-09-30 19:46

I think it's better to choose one that's easy to integrate with your IDE, but Web Essentials is common for Visual Studio.Compared to a single application, it runs automatically when you save files.


2022-09-30 19:46

I introduced the GUI app for Mac, but YUI Compressor might be easier.

YUI Compressor http://yui.github.io/yuicompressor/

It seems that the following commands can be used to minimize it.

$java-jar yuicompressor-x.y.z.jar myfile.js-o myfile-min.js

There seems to be a GUI (although it's a little old).

YUI Compressor GUI 1.1.0 Release | Ikemasa Blog
http://blog.ikemasa.com/yui-compressor-gui-1-1-0/


2022-09-30 19:46

All the answers are introduced to the tool, so I dare to transformational for your reference. Write about manual compression.

First, the code is compressed to accommodate read speed and obfuscation.
javascripts may contain extra code to enhance readability or
There are a lot of optional items.

So some of the early web developers were doing compression on their own.
Automating this know-how is the prototype of the current compression tool.

In other words, depending on the developer's skills, it can be compressed beyond the current tool.
Developers have the advantage of compressing the logic itself specifically for application purposes.

One example compression method
Omitted non-impact spaces, tabs and line feed characters.
Change if~else to ?: operator.
Replace objects and methods referenced more than once with short-name variables.

Reference Site
http://leaf.argyr.net/javascript/short-coding/

If you are interested in manual compression, search the keywords below.
· javascript code golf
· javascript short coding


2022-09-30 19:46

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.