Smart Compress

Overview

Description

ZealousWeb’s Smart Compress module is user-friendly and enables users to compress and format the data stored on ExpressionEngine in CSS and JS files. The Smart Compress add-on for ExpressionEngine allows you to compress all JS and CSS files used on the front end. It eliminates the hassle of compressing and uploading individual files and significantly reduces loading time.

Key Features

  • Easy to install and use - Simplified installation and user experience.
  • Supports LESS and SCSS - Works with both CSS preprocessors.
  • Multiple CSS formatters - Choose from formats like Expanded, Nested, Compact, Compressed, and Crunched.
  • JS minify or beautify options - Allows adding multiple JS files in a single list and choosing between minified or beautified output.
  • Customizable file names and paths - You control where files are saved and what they’re called.
  • Caching support - Create and manage cache with specific time durations.

Plugin's purpose and benefits

  • Selective file processing - Pick files based on server path, and check exactly which ones to compress or format.
  • PHP 8.2 compatibility - Supports the newest PHP version.
  • Supports ExpressionEngine 7 - Compatible with EE versions 3 through 7.

Get Started

Quick setup instructions

Obtain the add-on package and extract the ZIP file to a temporary location.
Step 1
Download and Unzip
Obtain the add-on package and extract the ZIP file to a temporary location.
Upload the extracted files to the appropriate directory on your server (`system/user/addons` for EE5+ or `system/expressionengine/third_party` for EE4 and below).
Step 2
Upload Files
Upload the extracted files to the appropriate directory on your server (`system/user/addons` for EE5+ or `system/expressionengine/third_party` for EE4 and below).
Ensure directories are set to `755` and files to `644`.
Step 3
Set Permissions
Ensure directories are set to `755` and files to `644`.
Log in to the ExpressionEngine Control Panel, navigate to the
Step 4
Install via Control Panel
Log in to the ExpressionEngine Control Panel, navigate to the "Add-Ons" section, and click "Install" next to the uploaded add-on.
Configure the add-on as per the developer's instructions and verify its functionality.
Step 5
Configure and Verify
Configure the add-on as per the developer's instructions and verify its functionality.
Questions about our plugins?

How To Use & Features

Files to Compress

  • To add all css or js files to format in single file, You have to create an input. That is all files to select and add in single place. To do so, create new settings under Files to Compress section.This would be basically an Input of files.You can create settings from multiple places.
  • Image - 1
  • Fill the required fields, Add a valid server path (Where all your css or js presents) and hit compile button. It will fire an AJAX call and get you the list of all the css/js files present in that directory. (No matter how many sub directories you have, it will bring all the files.)Enter any name in the name field, select type in type field and enter the server folder path on which files are exist.Once you hit compile button, you will have list of files (That matches your extension you select.)
  • Image - 2

Note: It is recommended not to select main jquery.js file. JQuery should always be at the top of all scripts. Always use JQuery file individually and not merge with our addon.

Image - 3

After fill out the form, Record will show under “Files to compress” listing in table. You can either delete it or edit it.

Image - 4

All form fields are described below:

  • Title:

    The title is to remember which inputs have been created. (It will be useful to find and select inputs in compressed output form.)

  • Type:

    You have to select which file type you want to add in this particular output.

  • Add folder path:

    Add folder path where all file exists.

  • Files:

    Based on server path all files will list here based on the type that you have selected before.

Compressed Output

Step 1 Would be to create input settings by creating settings under “Files to Compress” section.

This is step 2 (Last step) to create a single file with all the css/js inside.

After creating “Files to Compress”, You can create output settings from here. Click on create new settings to get a form. There is many places you can create this settings.

Image - 5

All form fields are described below:

  • Title:

    File title is for remembering what output is created.

  • Short name:

    Final merged css / js output file will be named from this short name. This field will use to give file name of newly generated output file.

  • Add folder path:

    You have to select which file type you want to add in this particular output. Based on type, “Add Files to compress with this output” section will change to view compress input list.

  1. Format You can set output format in below typesAvailable Formats for CSS
    1. Expanded
    2. Nested
    3. Compact
    4. Compressed
    5. Crunched

    Available Formats for JS:

    1. Minify
    2. Beautify
  2. Server Path:

    Add the server path where you want to create your file. Make sure you don’t add File name. You only need to enter the path till folder.

    • Path URL:

      Add URL path where you want to create your file. Make sure you don’t add File name. You only need to enter path till folder.

    • Add Files to compress with this output:

      It comes from “Files to compress” listing based on the type field selected above.

    • Cache:

      We offer to save final output in cache so there will be no process on each page reload. Pass how many minutes you want to cache the output file.

You can see all outputs you save on listing page. (Or we can say index page of addon settings.)

Custom Sidebar

We provide one “customSidebar” function in the MCP file. You can add more menus in the sidebar of the addon using this function.

/* To get dynamic menu in the addon */
function customSidebar(){
$sidebar = ee('CP/Sidebar')->make();
$this->navSettings = $sidebar->addHeader('Test Li');
}

Template Tags

{exp:smart_compress}

Parameters

  1. id
  2. short_name
  3. url_only
  4. show_error

Following Parameters can be use in Smart Compress tag.

id

Id of your “Compressed Output” list. You can pass any single ID to get css/js file URL of particular output.

Note: You can get output URL by either short_name or ID.

Example:

short_name="short_name_of_output"

short_name

Id of your “Compressed Output” list. You can pass any short name to get css/js file URL of particular output

Note: You can get output URL by either short_name or ID.

Example:

short_name="short_name_of_output"

url_only (For single tag. Not for tagdata.)

If set “yes”, output would be without any HTML css/js declaration. Tag will return only URL.

Example:

    id="1" url_only="yes"
OUTPUT: http://www.abc.com/cssfiles.css

If Set to “NO”, output would be with HTML css/js declaration.

Example:


id="1"
OUTPUT: <link rel="stylesheet" type="text/css" href="">

show_error

If set “yes”, It will return error if output fails to generate files. Basically one can use it to debug the output file.

Example:

show_error="yes"

Fields

1. output :

It will give you URL of css or js file.

Example:


{exp:smart_compress id="2"}
<link rel="stylesheet" type="text/css" href="{out}">
{/exp:smart_compress}
<link rel="stylesheet" type="text/css" href="{exp:smart_c}">
<script type="text/javascript" src="{exp:smart_compress i}">
{exp:smart_compress id='2'}
//No need to pass style declaration as it will genera  

Get Support

FAQs

Which type of files Smart Compress can compress?

No, Smart Compress add-on can compress Javascript and CSS files.

Change log

version 3.0.4

  • Compatibility of PHP Version 8.2.

version 3.0.3

  • Fixed MariaDB column length issue and EE7 compatibility

version 3.0.2

  • Moved from License logic to Subscription logic

version 3.0.1

  • solved issue while updating Expressionengine from EE5.0.3 to 5.x
  • added one condition in config.php file to get or set APP_VER global variable

version 3.0.0

  • Provided support of EE6.

version 2.0.0

  • Updated the license verification process and setup so please update the license in your addon.

version 1.0.0

  • Initial release.
    Note : There is no Changelog yet.

Get Premium Support

Request a Quote

Submit this form now and we will get back to you promptly!