The following warnings occurred:
Warning [2] Undefined array key "threadviews_countguests" - Line: 745 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php 745 errorHandler->error_callback
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined property: MyLanguage::$thread_modes - Line: 46 - File: showthread.php(1650) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php(1650) : eval()'d code 46 errorHandler->error_callback
/showthread.php 1650 eval




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Minify CSS
#1
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:

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')); ?>" />
Reply
#2
thank you for the sharing,
i will try this for sure, as load speed is crucial these days.
Best from France.
Reply
#3
I tried to use it and once I activate the plugin, it gives an error and breaks the entire website. 

Is it necessary to modify gsconfig file? 

It might be a dummy question, but I am not sure about the usage of the two functions, are both functions necessary?
Also, if not in the header, where else do I put the functions? 

Whatever I try, I can't get it to work.
Reply
#4
Hello,
when exactly does the problem occur?
After activating it, or when using one of its functions?
You say it gives an error, what does the error message say? And which PHP version is used?

I found that you were/are testing GetSimple 3.4. Do you also use it here? I do not know whether this plugin is compatible, because it was made and is currently in use with GetSimple 3.3.16.

***

No need to modify the gsconfig file.

Both functions do generally the same, they minify the css file(s) and provide the URL path of the minified version.
Which of the functions will be needed depends on what you want to achieve.

As usual with GetSimple, the get... function
Code:
get_minify_css()
echoes its result (which is the path to the minified css file) to the browser,

while the return... function
Code:
return_minify_css()
returns the path to the calling php function.


So if you just want to minify your css file and then refer the minified css in the HTML header of your template, you just insert there
Code:
<link rel="stylesheet" href="<?php get_minify_css('css/mystyle.css'); ?>" />
and it will point to the generated 'css/mystyle.min.css'.
I feel this is the most common usage.

But perhaps you wish to minify and after this do something more with the minified file, you might want to call it from functions.php.
Then you will probably use
Code:
return_minify_css('css/mystyle.css');
which returns the path to 'css/mystyle.min.css' to the caller, which in turn will do further work on this.

I hope usage is more clear now.
Reply
#5
(2021-01-23, 23:46:51)Knobbles Wrote: Hello,
when exactly does the problem occur?
After activating it, or when using one of its functions?
You say it gives an error, what does the error message say? And which PHP version is used?

I found that you were/are testing GetSimple 3.4. Do you also use it here? I do not know whether this plugin is compatible, because it was made and is currently in use with GetSimple 3.3.16.

***

No need to modify the gsconfig file.

Both functions do generally the same, they minify the css file(s) and provide the URL path of the minified version.
Which of the functions will be needed depends on what you want to achieve.

As usual with GetSimple, the get... function
Code:
get_minify_css()
echoes its result (which is the path to the minified css file) to the browser,

while the return... function
Code:
return_minify_css()
returns the path to the calling php function.


So if you just want to minify your css file and then refer the minified css in the HTML header of your template, you just insert there
Code:
<link rel="stylesheet" href="<?php get_minify_css('css/mystyle.css'); ?>" />
and it will point to the generated 'css/mystyle.min.css'.
I feel this is the most common usage.

But perhaps you wish to minify and after this do something more with the minified file, you might want to call it from functions.php.
Then you will probably use
Code:
return_minify_css('css/mystyle.css');
which returns the path to 'css/mystyle.min.css' to the caller, which in turn will do further work on this.

I hope usage is more clear now.

Now it works.
I was inserting a / before the path. Like this ('/css/mystyle.css');
Thank you for the promptly response.
Reply




Users browsing this thread: 1 Guest(s)