github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

mcurry / asset

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 29
    • 5
  • Source
  • Commits
  • Network (5)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

CakePHP Plugin - Automatically combine and compress CSS and JS files. — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

formatting 
mcurry (author)
Fri Jul 10 21:45:00 -0700 2009
commit  91bf04a2025c48f63440fde750429893556976c8
tree    388026b2444f35cb6ac4f425940832a6a03ac774
parent  3360d9c1c300c3f7a828ff0758b8d9679e50907d
asset /
name age
history
message
file README Thu May 07 23:03:41 -0700 2009 updated file headers [unknown]
directory extras/ Thu May 07 22:56:07 -0700 2009 made into plugin. added unit test [unknown]
directory tests/ Mon Jun 15 20:07:57 -0700 2009 fixed script ordering when in debug mode [mcurry]
directory vendors/ Fri May 08 18:57:06 -0700 2009 more unit tests [unknown]
directory views/ Fri Jul 10 21:45:00 -0700 2009 formatting [mcurry]
README
/*
 * Asset Packer CakePHP Plugin
 * Copyright (c) 2009 Matt Curry
 * www.PseudoCoder.com
 * http://github.com/mcurry/asset
 *
 * @author      Matt Curry <matt@pseudocoder.com>
 * @license     MIT
 *
 */

/* Notes */
    * JavaScript packing only works with PHP5. If you're using PHP4 the scripts will still be merged into one file, but 
    not packed.
    * A sample .htaccess file is included in the zip. Rename it and drop it in output dirs for improved performance.

/* Instructions */
   1. You'll need a working version of CakePHP installed. This is running on 1.2.2.8120 stable.
   2. Download jsmin 1.1.0 or later and put it in vendors/jsmin.
   3. Download CSSTidy 1.3 or later and put the contents in vendors/csstidy.
   4. Download the plugin to /app/plugins/asset.
   5. Include the helper in any controller that will need it. Most likely you will put it in AppController so that it's 
   available to all your controllers:
      var $helpers = array('Asset.asset');

   6. In your layout and views include Javascript files as you normally would when using the $scripts_for_layout 
   approach:
      $javascript->link('jquery', false);

   7. Similarly include your css with the inline option set to false:
      $html->css('style', null, null, false);

   8. Then in your layout file, in the head section, instead of using $scripts_for_layout call the helper:
      echo $asset->scripts_for_layout();

/* Tips */
    * By default the cached files are written to /app/webroot/cjs and /app/webroot/ccss.  You can change that by 
    setting:
      Configure::write('Asset.jsPath', 'some/path');
      Configure::write('Asset.cssPath', 'some/path');
      Don't include slashes at the beginning or end.  Path will be relative to /app/webroot.  So if set:
      Configure::write('Asset.jsPath', 'js/packed');
      The path will be /app/webroot/js/packed
    * Remember to set the inline option to false for JS and CSS in your layout if you want them to be packed with the 
    view scripts.
    * Setting DEBUG on will cause this helper to output the scripts the same way $scripts_for_layout would, effectifly 
    turning it off while testing.
    * If you get a JavaScript error with a packed version of a file it's most likely missing a semi-colon somewhere.
    * Order is important. If you include script1 then script2 on one view and script2 then script1 on another, they will 
    generate separate packed versions and will be treated by the browser as separate scripts.
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server