Code Monkey home page Code Monkey logo

minify's Introduction

Minify!

Description

Minify optimize, compress and combine your css and javascript files on the fly!

Even though Minify is called every request you won't notice it. The script in demo/ takes about 0.009 seconds to verify and check 26 different files with a memory usage of 1.248MB (and remember that this is with 26 files!).

Update: Minify is now available as a package to FuelPHP!

Usage

<?php
Minify::add('https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js');
Minify::add('script.js');
Minify::add('reset.css');
Minify::add('design.css');
Minify::run();
Minify::printLinks();
?>

Know Issues

  • Minify won't recompress when options are changed.
  • If compressCode is false Minify will still use a file's compressed code if cached (and vise versa).
  • Under rare circumstances Minify may fail to recompress (fixed?).
  • Changing useLocalJS to true will crash Minify (due to localJS not being implemented yet).

Upcoming Features and Ideas

  • HTML compression.
    • This would require Minify to catch and supress any output by PHP and compress it during shutdown.
    • A more basic implementation would be to pass any HTML code to a method within Minify.
  • Implement CLI-based JS compression.
    • Options switch currently implemented as useLocalJS (see known issues).
  • Unit Testing
    • The current demo is the only way to test if Minify actually works after code changes (except for a few sites hooked up directly to the trunk).
    • I'd be able to automatically try all different kinds of circumstances where a recompress should happen.
      • File change (obviously).
      • Missing minified file.
      • Truncated checksum file.
      • Missing checksum file.
      • Changed options.
      • Missing files.
      • Added files.
  • Refactor Code
  • Toggle file combination.
    • combineFiles switch to toggle if all code should be combined into a single file or if they should be separated.

minify's People

Contributors

jyggen avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

tmisi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.