Minification of JS/CSS with Composer for compatibility

This commit is contained in:
Stefan Kalscheuer 2018-06-14 17:56:03 +02:00
parent 14a6387218
commit 358602bf48
7 changed files with 25 additions and 8 deletions

4
.gitignore vendored
View File

@ -2,4 +2,6 @@ composer.lock
/vendor/ /vendor/
/node_modules/ /node_modules/
/dist/ /dist/
.idea .idea
**/*.min.css
**/*.min.js

View File

@ -2,8 +2,9 @@
* Contributors: Stefan Kalscheuer * Contributors: Stefan Kalscheuer
* Tags: liveticker, feed, rss * Tags: liveticker, feed, rss
* Requires at least: 3.8 * Requires at least: 4.0
* Tested up to: 4.9 * Tested up to: 4.9
* Requires PHP: 5.2
* Stable tag: 1.0.0-alpha * Stable tag: 1.0.0-alpha
* License: GPLv2 or later * License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html * License URI: http://www.gnu.org/licenses/gpl-2.0.html

View File

@ -128,7 +128,7 @@ class RoboFile extends Tasks {
$this->testCS(); $this->testCS();
} }
$this->bundle(); $this->bundle();
$this->minify( $opts ); // $this->minify( $opts );
} }
/** /**

View File

@ -31,16 +31,26 @@
"wimg/php-compatibility": "^8.0", "wimg/php-compatibility": "^8.0",
"wp-coding-standards/wpcs": "~0.14", "wp-coding-standards/wpcs": "~0.14",
"patchwork/jsqueeze": "^2.0.5", "patchwork/jsqueeze": "^2.0.5",
"natxet/CssMin": "^3.0.5" "natxet/CssMin": "^3.0.5",
"matthiasmullie/minify": "^1.3"
}, },
"scripts": { "scripts": {
"post-install-cmd": [
"@minify"
],
"post-update-cmd": [
"@minify"
],
"build": [ "build": [
"@minify",
"robo build" "robo build"
], ],
"package": [ "package": [
"@minify",
"robo package" "robo package"
], ],
"deploy": [ "deploy": [
"@minify",
"robo deploy:all" "robo deploy:all"
], ],
"test-all": [ "test-all": [
@ -55,6 +65,10 @@
], ],
"fix-cs": [ "fix-cs": [
"phpcbf --standard=phpcs.xml" "phpcbf --standard=phpcs.xml"
],
"minify": [
"minifycss styles/wp-liveticker2.css > styles/wp-liveticker2.min.css",
"minifyjs scripts/wp-liveticker2.js > scripts/wp-liveticker2.min.js"
] ]
} }
} }

View File

@ -250,7 +250,7 @@ class WPLiveticker2 {
if ( self::$shortcode_present || self::$widget_present ) { if ( self::$shortcode_present || self::$widget_present ) {
wp_enqueue_style( wp_enqueue_style(
'wplt-css', 'wplt-css',
WPLT2_BASE . 'styles/wp-liveticker2.css', WPLT2_BASE . 'styles/wp-liveticker2.min.css',
'', '',
self::VERSION, 'all' self::VERSION, 'all'
); );
@ -265,7 +265,7 @@ class WPLiveticker2 {
if ( self::$shortcode_present || self::$widget_present ) { if ( self::$shortcode_present || self::$widget_present ) {
wp_enqueue_script( wp_enqueue_script(
'wplt2-js', 'wplt2-js',
WPLT2_BASE . 'scripts/wp-liveticker2.js', WPLT2_BASE . 'scripts/wp-liveticker2.min.js',
array( 'jquery' ), array( 'jquery' ),
self::VERSION, self::VERSION,
true true

View File

@ -21,6 +21,6 @@
</rule> </rule>
<!-- PHP compatibility level --> <!-- PHP compatibility level -->
<config name="testVersion" value="5.5-"/> <config name="testVersion" value="5.2-"/>
<rule ref="PHPCompatibility"/> <rule ref="PHPCompatibility"/>
</ruleset> </ruleset>

View File

@ -11,7 +11,7 @@
* Description: A simple Liveticker for Wordpress. * Description: A simple Liveticker for Wordpress.
* Version: 1.0.0 alpha * Version: 1.0.0 alpha
* Author: Stefan Kalscheuer * Author: Stefan Kalscheuer
* Author URI: http://www.stklcode.de * Author URI: https://www.stklcode.de
* Text Domain: wplt2 * Text Domain: wplt2
* Domain Path: /lang * Domain Path: /lang
* License: GPLv2 or later * License: GPLv2 or later