Minify CSS

Downloads: 257
Category: Plugin
Compatible with: GetSimple 3.3 - 3.3

Last Updated: August 31, 2020
Tags: css minify minification
Author: Knobbles
Support: Support Forum

(5) 2 Votes

Plugin Description:

This small plugin minifies one or more .css files to a common .min.css file.

When used in template header, you can automatically generate and refer a minimized version of your css file(s).

Usage
Two functions are provided:

 return_minify_css(file1.css, [file2.css], ...)

returns the url of the resulting min.css file.

 get_minify_css(file1.css, [file2.css], ...)

echoes the url of the resulting min.css file.

Both functions accept a variable number of css file paths as parameters.

The output file name is derived from the last file name parameter, supplemented with ".min.css".
This last file does not need to exist, so you can minify and combine 'css/style1.css' and 'css/style2.css' to generate 'css/common.min.css'
through calling

return_minify_css('css/style1.css', 'css/style2.css', 'css/common');

or in the template header

<link rel="stylesheet" href="<?php get_minify_css('css/style1.css', 'css/style2.css', 'css/common'); ?>" />

CSS file names can be:
* starting with http:// or https://, this can be a local or a remote css file (do not use remote url as last parameter, because the output file is derived from this, so make sure to add a local name parameter at last),
* starting with '/', this is file is relative to the local site root, or to the root path in GSROOTPATH
* otherwise, the file path is relative to the current theme.

This plugin can also be used in combination with the [SCSS plugin] (http://get-simple.info/extend/plugin/scss/794/):

<link rel="stylesheet" href="<?php get_minify_css(return_scss_css('css/main.scss')); ?>" />

Install Instructions:

Unzip and upload the file (it is only one file) to your plugins directory, then activate. There are no configuration options.