Skip to content
This repository has been archived by the owner on Mar 16, 2023. It is now read-only.
/ minify.sh Public archive

Minify CSS and HTML files from the command line. Made with @nathanaelhoun

License

Notifications You must be signed in to change notification settings

lucas-cosson/minify.sh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

minify.sh

Minify CSS and HTML source code from the command line using dash, by Lucas Cosson & Nathanaël Houn

Made as a shell project for L2-S4 "Système"

What can it do ?

This tool can reduce HTML and CSS from the command line, reproducing the whole tree view of a source_folder into an the dest_folder with the minified code. It deleted extra spaces and comments from the source code.

Usage : ./minifier.sh [OPTION]... dir_source dir_dest

    Minifies HTML and/or CSS files with :
        dir_source path to the root directory of the website to be minified
        dir_dest path to the root directory of the minified website

    OPTIONS
    --help      show help and exit
    -v          displays the list of minified files; and for each
                file, its final and initial sizes, and its reduction
                percentage
    -f          if the dir_dest file exists, its content is
                removed without asking for confirmation of deletion
    --css       CSS files are minified
    --html      HTML files are minified
    if none of the 2 previous options is present, the HTML and CSS
    files are minified

    -t tags_file the "white space" characters preceding and following the
                tags (opening or closing) listed in the ’tags_file’ are deleted

Tools used

We use tr, sed and perl to remove unecessary code (spaces, line breaks, comments) from the existing files and du to calculate disk usage.

Possible improvements

  • Reduce media
  • Minify JavaScript scripts

Who has done what

We wrote the code to handle the arguments and to copy the tree view together. Lucas made the css minification, and Nathanaël did the html minification.

About

Minify CSS and HTML files from the command line. Made with @nathanaelhoun

Resources

License

Stars

Watchers

Forks

Languages