This small plugin minifies one or more .css files to a common .min.css file.
The plugin is here: Minify CSS
When used in template header, you can automatically generate and refer a minimized version of your css file(s).
Usage
Two functions are provided:
returns the url of the resulting min.css file.
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
or in the template header
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 :
The plugin is here: Minify CSS
When used in template header, you can automatically generate and refer a minimized version of your css file(s).
Usage
Two functions are provided:
Code:
return_minify_css(file1.css, [file2.css], ...)
returns the url of the resulting min.css file.
Code:
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
Code:
return_minify_css('css/style1.css', 'css/style2.css', 'css/common')
or in the template header
Code:
<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 :
Code:
<link rel="stylesheet" href="<?php get_minify_css(return_scss_css('css/main.scss')); ?>" />