[libcode-tidyall-perl] 332/374: add cssunminifier
Jonas Smedegaard
js at alioth.debian.org
Sun Sep 29 22:26:46 UTC 2013
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository libcode-tidyall-perl.
commit 68173cc02d48e0de0b98eb3bd330e420f6b0576b
Author: Jonathan Swartz <swartz at pobox.com>
Date: Wed Oct 17 03:09:17 2012 -0700
add cssunminifier
---
.ispell_english | 1 +
Changes | 3 +-
bin/tidyall | 8 ++++
lib/Code/TidyAll/Plugin/CSSUnminifier.pm | 55 ++++++++++++++++++++++++++++
lib/Code/TidyAll/Plugin/PHPCodeSniffer.pm | 4 ++
lib/Code/TidyAll/t/Plugin/CSSUnminifier.pm | 19 ++++++++++
xt/author/Plugin-CSSUnminifier.t | 3 ++
7 files changed, 92 insertions(+), 1 deletion(-)
diff --git a/.ispell_english b/.ispell_english
index 0dbed4e..6c23fd2 100644
--- a/.ispell_english
+++ b/.ispell_english
@@ -45,5 +45,6 @@ svn
tidiers
tidyall
txn
+cssunminifier
validator
validators
diff --git a/Changes b/Changes
index 7efdc94..c5691db 100644
--- a/Changes
+++ b/Changes
@@ -5,7 +5,8 @@ Revision history for Code-TidyAll
0.16 Oct 11, 2012
* Plugins
- - Add PHPCodeSniffer plugin (Joseph Crotty)
+ - Add phpcs plugin (Joseph Crotty)
+ - Add cssunminifier plugin
0.15 Oct 11, 2012
diff --git a/bin/tidyall b/bin/tidyall
index 58325ab..5d095f5 100755
--- a/bin/tidyall
+++ b/bin/tidyall
@@ -259,6 +259,14 @@ JavaScript: L<js-beautify|Code::TidyAll::Plugin::JSBeautify>,
L<jshint|Code::TidyAll::Plugin::JSHint>,
L<jslint|Code::TidyAll::Plugin::JSLint>
+=item *
+
+CSS: L<cssunminifier|Code::TidyAll::Plugin::CSUnminifier>
+
+=item *
+
+PHP: L<phpcs|Code::TidyAll::Plugin::CSUnminifier>
+
=back
See L<Code::TidyAll::Plugin|Code::TidyAll::Plugin> for information about
diff --git a/lib/Code/TidyAll/Plugin/CSSUnminifier.pm b/lib/Code/TidyAll/Plugin/CSSUnminifier.pm
new file mode 100644
index 0000000..da0a949
--- /dev/null
+++ b/lib/Code/TidyAll/Plugin/CSSUnminifier.pm
@@ -0,0 +1,55 @@
+package Code::TidyAll::Plugin::CSSUnminifier;
+use IPC::System::Simple qw(run);
+use Moo;
+extends 'Code::TidyAll::Plugin';
+
+sub _build_cmd { 'cssunminifier' }
+
+sub transform_file {
+ my ( $self, $file ) = @_;
+
+ run( $self->cmd, $self->argv, $file, $file );
+}
+
+1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Code::TidyAll::Plugin::CSUnminifier - use cssunminifier with tidyall
+
+=head1 SYNOPSIS
+
+ In configuration:
+
+ [CSSUnminifier]
+ select = static/**/*.css
+ argv = -w=2
+
+=head1 DESCRIPTION
+
+Runs L<cssunminifier|https://npmjs.org/package/cssunminifier>, a simple CSS
+tidier.
+
+=head1 INSTALLATION
+
+Install L<npm|https://npmjs.org/>, then run
+
+ npm install cssunminifier -g
+
+=head1 CONFIGURATION
+
+=over
+
+=item argv
+
+Arguments to pass to C<cssunminifier>
+
+=item cmd
+
+Full path to C<cssunminifier>
+
+=back
diff --git a/lib/Code/TidyAll/Plugin/PHPCodeSniffer.pm b/lib/Code/TidyAll/Plugin/PHPCodeSniffer.pm
index fbfe75a..ad54fb9 100644
--- a/lib/Code/TidyAll/Plugin/PHPCodeSniffer.pm
+++ b/lib/Code/TidyAll/Plugin/PHPCodeSniffer.pm
@@ -61,4 +61,8 @@ Install L<PEAR|http://pear.php.net/>, then install C<phpcs> from PEAR:
Arguments to pass to C<phpcs>
+=item cmd
+
+Full path to C<phpcs>
+
=back
diff --git a/lib/Code/TidyAll/t/Plugin/CSSUnminifier.pm b/lib/Code/TidyAll/t/Plugin/CSSUnminifier.pm
new file mode 100644
index 0000000..d178fb5
--- /dev/null
+++ b/lib/Code/TidyAll/t/Plugin/CSSUnminifier.pm
@@ -0,0 +1,19 @@
+package Code::TidyAll::t::Plugin::CSSUnminifier;
+use Test::Class::Most parent => 'Code::TidyAll::t::Plugin';
+
+sub test_main : Tests {
+ my $self = shift;
+
+ my $source = 'body {\nfont-family:helvetica;\nfont-size:15pt;\n}';
+ $self->tidyall(
+ source => $source,
+ expect_tidy => 'body {\n font-family: helvetica;\n font-size: 15pt;\n}\n'
+ );
+ $self->tidyall(
+ source => $source,
+ conf => { argv => '-w=2' },
+ expect_tidy => 'body {\n font-family: helvetica;\n font-size: 15pt;\n}\n'
+ );
+}
+
+1;
diff --git a/xt/author/Plugin-CSSUnminifier.t b/xt/author/Plugin-CSSUnminifier.t
new file mode 100644
index 0000000..636ab01
--- /dev/null
+++ b/xt/author/Plugin-CSSUnminifier.t
@@ -0,0 +1,3 @@
+#!/usr/bin/perl
+use Code::TidyAll::t::Plugin::CSSUnminifier;
+Code::TidyAll::t::Plugin::CSSUnminifier->runtests;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libcode-tidyall-perl.git
More information about the Pkg-perl-cvs-commits
mailing list