Documentation

minifier.php

\file \brief JS and CSS minifier.

Use this script to minify JS and CSS files from src/js and src/css to js/ and css/.

PHP version 8.1

Tags
category

Documentation

author

HugoFara hugo.farajallah@protonmail.com

license

Unlicense http://unlicense.org/

link
https://hugofara.github.io/lwt/docs/html/minifier_8php.html
since
2.0.3-fork
since
2.9.1-fork

$jsFiles was replaced by LWT_JS_FILES and $cssFiles by LWT_CSS_FILES

Table of Contents

Constants

LWT_CSS_FILES  = array('src/css/css_charts.css', 'src/css/feed_wizard.css', 'src/css/gallery.css', 'src/css/jplayer.css', 'src/css/jquery-ui.css', 'src/css/jquery.tagit.css', 'src/css/styles.css')
LWT_JS_FILES  = array('src/js/audio_controller.js', 'src/js/third_party/countuptimer.js', 'src/js/jq_feedwizard.js', 'src/js/jq_pgm.js', 'src/js/pgm.js', 'src/js/translation_api.js', 'src/js/unloadformcheck.js', 'src/js/third_party/sorttable.js', 'src/js/user_interactions.js')

Functions

minifyJS()  : string
Minify a JavaScript file and outputs the result to js/
minifyCSS()  : string
Minify a JavaScript file and outputs the result to css/
minifyAllJS()  : string
Minify all JavaScript files
minifyAllCSS()  : void
Minify all Cascading-Style Sheet (CSS) files
regenerateSingleTheme()  : void
Regenerate a single theme.
regenerateThemes()  : void
Find and regenerate all themes. CSS is minified while other files are copied.
minify_everything()  : void
One-do-all command to minify all your JS, CSS, and regenerate themes.

Constants

LWT_CSS_FILES

public array<string|int, string> LWT_CSS_FILES = array('src/css/css_charts.css', 'src/css/feed_wizard.css', 'src/css/gallery.css', 'src/css/jplayer.css', 'src/css/jquery-ui.css', 'src/css/jquery.tagit.css', 'src/css/styles.css')

LWT_CSS_FILES All the paths of CSS files to be minified.

LWT_JS_FILES

public array<string|int, string> LWT_JS_FILES = array('src/js/audio_controller.js', 'src/js/third_party/countuptimer.js', 'src/js/jq_feedwizard.js', 'src/js/jq_pgm.js', 'src/js/pgm.js', 'src/js/translation_api.js', 'src/js/unloadformcheck.js', 'src/js/third_party/sorttable.js', 'src/js/user_interactions.js')

LWT_JS_FILES All the paths of JS files to be minified

Functions

minifyJS()

Minify a JavaScript file and outputs the result to js/

minifyJS(string $path, string $outputPath) : string
Parameters
$path : string

Input file path with extension.

$outputPath : string

Output file path with extension

Tags
since
2.2.2-fork

Relative paths in the returned content is the same as the saved content.

Return values
string

Minified content

minifyCSS()

Minify a JavaScript file and outputs the result to css/

minifyCSS(string $path, string $outputPath) : string
Parameters
$path : string

Input file path with extension.

$outputPath : string

Output file path with extension

Tags
since
2.2.2-fork

Relative paths in the returned content is the same as the saved content.

Return values
string

Minified content

minifyAllJS()

Minify all JavaScript files

minifyAllJS() : string
Tags
since
2.0.3-fork
since
2.3.0-fork

JS code is "combined" above being minified: only one file is outputted.

Return values
string

Minified code

minifyAllCSS()

Minify all Cascading-Style Sheet (CSS) files

minifyAllCSS() : void
Tags
since
2.0.3-fork

regenerateSingleTheme()

Regenerate a single theme.

regenerateSingleTheme(string $parent_folder, string $theme_folder) : void
Parameters
$parent_folder : string

Path to the parent folder (I. E. src/themes/)

$theme_folder : string

Name of the theme folder

regenerateThemes()

Find and regenerate all themes. CSS is minified while other files are copied.

regenerateThemes() : void

Nested folders are ignored.

minify_everything()

One-do-all command to minify all your JS, CSS, and regenerate themes.

minify_everything() : void

        
On this page

Search results