Code Monkey home page Code Monkey logo

minify's Introduction

About

‘Minify’ is a plugin to minify JavaScript and/or CSS code and combine it
into one file on the fly. This will increase performance of website.
So you don’t need to do dozens HTTP request for every JavaScript or CSS file. Minify plugin is more
useful and faster with Funky cache
plugin.

Usage

Install the minify plugin to your Frog CMS plugins directory:


$cd /path/to/frog/plugins/
$git clone git://github.com/dknight/minify.git

Activate minify plugin

Set the settings in the

So next step you need to create ‘cache’ directory in your document root and make it
writable. Due to security settings most webservers doesn’t allow you to create
directories dynamically, so you need to create it manually. Create it in your DOCUMENT_ROOT/cache/
and set writtable permissions.


$mkdir /website/root/cache/
$chmod 0666 /website/root/cache/

Usage in Frog CMS


<?php
$jsFiles = array(
    '/public/javascripts/jquery-1.3.2.min.js',
    '/public/javascripts/jquery.validate.min.js',
    '/public/javascripts/jquery.form.js',
    '/public/javascripts/frog.js'
);
$cssFiles = array(
    'path/to/master.css',
    'path/to/subpage.css',
    'path/to/ie-fix.css'
);

$js_minify  = Minify::factory('js');
$css_minify = Minify::factory('css');
?>

HTML:

<pre> ... <link href="<?php echo $css_minify->minify($cssFiles, true); ?>" rel="stylesheet" type="text/css" /> ... <script type="text/javascript" src="<?php echo $js_minify->minify($files, true); ?>"></script> ...

The ‘minify’ method can pass 3 parameters:

name description type default
files File to be minified array [required] array()
output Output to file or raw output into string boolean [optinal] false
fileName Name of output file string [optinal] ‘min.js’ or ‘min.css’

minify's People

Contributors

dknight avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

raylouis

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.