1 person following this project (follow)

Project Description
This extension will provide a way to manage javascript and stylesheet files for inclusion in your templates. Compression, combination and minification are included.

To install, simply drag the system folder over the root directory of your N2F Yverdon installation.

Some Notes
  • CSS does not currently support minification.
  • Compression is basic GZIP using PHP's gzencode() function
  • Relies on the n2f_template extensions

A Quick Example

Inside of the main sys.ext.php file (~/modules/main/sys.ext.php), place the following code:

// Make sure we have the extension
n2f_cls::getInstance()->requireExtensions(array('scrylemgr'));

// Add some JS files (these are located in ~/resources/javascript/default/)
scrylemgr::addJsFile('jquery', 'jquery.js');
scrylemgr::addJsFile('site', 'site.js');

// Add some CSS files (these are located in ~/resources/stylesheets/default/)
scrylemgr::addCssFile('reset', 'reset.css');
scrylemgr::addCssFile('layout', 'layout.css');
scrylemgr::addCssFile('green', 'colors/green.css');

Then inside of the main header.tpl file (~/modules/main/tpl/default/header.tpl) place the following tags inside the <head></head> section:

<cssinc baseurl="resources/stylesheets/default/" />
<jsinc baseurl="resources/javascript/default/" />

Full Usage

The full set of available arguments for both of the main methods:

scrylemgr::addJsFile('key', 'filename', 'dependencies', SCRYLEOPT_BASEURL_EXEMPT | SCRYLEOPT_MINIFY_EXEMPT | SCRYLEOPT_COMBINE_EXEMPT | SCRYLEOPT_COMPRESS_EXEMPT);
scrylemgr::addCssFile('key', 'filename', 'dependencies', SCRYLEOPT_BASEURL_EXEMPT | SCRYLEOPT_COMBINE_EXEMPT | SCRYLEOPT_COMPRESS_EXEMPT);

The full set of attributes available to both tags:

<cssinc baseurl="baseurl" tabsize="2" compress="true" combine="true" />
<jsinc baseurl="baseurl" tabsize="2" compress="true" combine="true" minify="true" />

Last edited Nov 17 2010 at 2:00 PM by Zibings, version 3