Commit 094519e8 authored by Xavier Guimard's avatar Xavier Guimard

Replace own minifier by yui-compressor (Closes: #908)

parent dfb9b159
......@@ -3,6 +3,13 @@
# Prefix for packaging
DESTDIR=
# Flag for optimizations
PROD=no
# Compression
JSCOMPRESS=$(PROD)
CSSCOMPRESS=$(PROD)
PERL=$$(which perl)
PERLVERSION=`perl -e '$$version = $$^V; $$version =~ s/v//; print $$version'`
SU=su -c
......@@ -419,13 +426,32 @@ install_manager_site: install_conf_dir
@install -v -d ${RMANAGERDIR} $(RMANAGERSTATICDIR) $(RMANAGERPSGIDIR) \
$(RMANAGERTEMPLATESDIR)
@cp -pR $(SRCMANAGERDIR)/site/static/* $(RMANAGERSTATICDIR)
@cp -pR $(SRCMANAGERDIR)/site/templates/* $(RMANAGERTEMPLATESDIR)
@for f in $(SRCMANAGERDIR)/site/templates/*.tpl; do \
./scripts/transform-templates jsminified $(JSCOMPRESS) cssminified $(CSSCOMPRESS) <$$f \
> $(RMANAGERTEMPLATESDIR)/`basename $$f`; \
done
@cp -pR $(SRCMANAGERDIR)/eg/* $(RMANAGERPSGIDIR)
# Clean svn files
@rm -rf $$(find ${RMANAGERDIR} ${RMANAGERSTATICDIR} $(RMANAGERPSGIDIR) \
$(RMANAGERTEMPLATESDIR) $(RCONFDIR) -type d -name .svn)
$(PERL) -i -pe 's#__MANAGERSTATICDIR__#$(MANAGERRELATIVESTATICDIR)#g' $(RCONFDIR)/$(CONFFILENAME)
$(PERL) -i -pe 's#__MANAGERTEMPLATESDIR__#$(MANAGERTEMPLATESDIR)#g' $(RCONFDIR)/$(CONFFILENAME)
@if test "$(CSSCOMPRESS)" = "yes"; then \
for f in $(RMANAGERSTATICDIR)/css/*; do \
if test "$${f%%.min.css}" = "$$f"; then \
echo "Compressing $$f"; \
yui-compressor $$f >$${f%%.css}.min.css; \
fi; \
done; \
fi
@if test "$(JSCOMPRESS)" = "yes"; then \
for f in $(RMANAGERSTATICDIR)/js/*; do \
if test "$${f%%.min.js}" = "$$f"; then \
echo "Compressing $$f"; \
yui-compressor $$f >$${f%%.js}.min.js; \
fi; \
done; \
fi
install_portal_site: install_conf_dir
# Portal install
......
......@@ -42,7 +42,8 @@ Build-Depends-Indep: libapache-session-perl,
libxml-libxslt-perl,
libxml-simple-perl,
omegat,
perl
perl,
yui-compressor
Standards-Version: 3.9.6
Vcs-Browser: https://anonscm.debian.org/cgit/pkg-perl/packages/lemonldap-ng.git
Vcs-Git: git://anonscm.debian.org/pkg-perl/packages/lemonldap-ng.git
......
......@@ -46,10 +46,8 @@ override_dh_auto_install:
APACHEUSER=www-data \
APACHEGROUP=www-data \
DEFDOCDIR=/usr/share/doc/lemonldap-ng-doc \
FRDOCDIR=/usr/share/doc/lemonldap-ng-fr-doc
test -n "$$LOCALBUILD" || ./scripts/minifierjs $$(find debian/tmp/ -name '*.js')
test -n "$$LOCALBUILD" || ./scripts/minifiercss $$(find debian/tmp/ -name '*.css')
FRDOCDIR=/usr/share/doc/lemonldap-ng-fr-doc \
PROD=yes
mkdir $(TMP)/$(LMSHAREDIR)/manager $(TMP)/$(LMSHAREDIR)/portal
mv $(TMP)/$(LMVARDIR)/portal/*.pl $(TMP)/$(LMSHAREDIR)/portal/
......
......@@ -230,7 +230,7 @@ the first word of /path/info.
=item $dest:
string, sub ref or hash ref (see "Route types" bellow)
string, sub ref or hash ref (see "Route types" below)
=item $methods:
......
......@@ -9,5 +9,8 @@
<link rel="stylesheet" type="text/css" href="<TMPL_VAR NAME="STATIC_PREFIX">bwr/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="<TMPL_VAR NAME="STATIC_PREFIX">bwr/bootstrap/dist/css/bootstrap-theme.min.css" />
<link rel="stylesheet" type="text/css" href="<TMPL_VAR NAME="STATIC_PREFIX">bwr/angular-ui-tree/dist/angular-ui-tree.min.css" />
<!-- //if:cssminified
<link rel="stylesheet" type="text/css" href="<TMPL_VAR NAME="STATIC_PREFIX">css/manager.min.css" />
//else -->
<link rel="stylesheet" type="text/css" href="<TMPL_VAR NAME="STATIC_PREFIX">css/manager.css" />
<!-- //endif -->
......@@ -168,8 +168,14 @@
<TMPL_INCLUDE NAME="scripts.tpl">
<!-- //if:jsminified
<script type="text/javascript" src="<TMPL_VAR NAME="STATIC_PREFIX">js/conftree.min.js"></script>
<script type="text/javascript" src="<TMPL_VAR NAME="STATIC_PREFIX">js/filterFunctions.min.js"></script>
<script type="text/javascript" src="<TMPL_VAR NAME="STATIC_PREFIX">js/manager.min.js"></script>
//else -->
<script type="text/javascript" src="<TMPL_VAR NAME="STATIC_PREFIX">js/conftree.js"></script>
<script type="text/javascript" src="<TMPL_VAR NAME="STATIC_PREFIX">js/filterFunctions.js"></script>
<script type="text/javascript" src="<TMPL_VAR NAME="STATIC_PREFIX">js/manager.js"></script>
<!-- //endif -->
<TMPL_INCLUDE NAME="footer.tpl">
......@@ -133,6 +133,10 @@
<TMPL_INCLUDE NAME="scripts.tpl">
<!-- //if:jsminified
<script type="text/javascript" src="<TMPL_VAR NAME="STATIC_PREFIX">js/notifications.min.js"></script>
//else -->
<script type="text/javascript" src="<TMPL_VAR NAME="STATIC_PREFIX">js/notifications.js"></script>
<!-- //endif -->
<TMPL_INCLUDE NAME="footer.tpl">
......@@ -35,5 +35,8 @@
<script type="text/javascript" src="<TMPL_VAR NAME="STATIC_PREFIX">bwr/angular/angular.min.js"></script>
<script type="text/javascript" src="<TMPL_VAR NAME="STATIC_PREFIX">bwr/angular-ui-tree/dist/angular-ui-tree.min.js"></script>
<script type="text/javascript" src="<TMPL_VAR NAME="STATIC_PREFIX">js/ui-bootstrap-tpls-0.12.1.min.js"></script>
<!-- //if:jsminified
<script type="text/javascript" src="<TMPL_VAR NAME="STATIC_PREFIX">js/llApp.min.js"></script>
//else -->
<script type="text/javascript" src="<TMPL_VAR NAME="STATIC_PREFIX">js/llApp.js"></script>
<!-- //endif -->
......@@ -111,6 +111,10 @@
<TMPL_INCLUDE NAME="scripts.tpl">
<!-- //if:jsminified
<script type="text/javascript" src="<TMPL_VAR NAME="STATIC_PREFIX">js/sessions.min.js"></script>
//else -->
<script type="text/javascript" src="<TMPL_VAR NAME="STATIC_PREFIX">js/sessions.js"></script>
<!-- //endif -->
<TMPL_INCLUDE NAME="footer.tpl">
This diff is collapsed.
This diff is collapsed.
#!/usr/bin/perl -w
use JavaScript::Beautifier qw/js_beautify/;
unless ( $ARGV[0] and -e $ARGV[0] ) {
die "Usage $0 <file.js>";
}
open F, $ARGV[0] or die($!);
my $src;
while (<F>) { $src .= $_; }
close F;
my @clean = split /\n/, js_beautify( $src, {
indent_size => 1, indent_character => "\t", preserve_newlines => 1 }
);
# Clean long lines for tabs
foreach(@clean){
if(/\[\s*.{70}/ and /\[\s*(?:['"].*['"],\s*)*\]/) {
/^(\s*)/;
my $tab = $1;
s/(['"])([^"']*)\1(,?)\s*/ $1$2$1$3\n$tab /g;
}
$_.="\n";
}
open F, ">",$ARGV[0] or die($!);
print F @clean;
#!/usr/bin/perl -Iscripts
use CSS::Minifier 'minify';
foreach my $f (@ARGV) {
unless(-e $f) {
print STDERR "$f doesn't exists, skipping\n";
next;
}
unless(-w $f) {
print STDERR "$f is not writeable, skipping\n";
next;
}
my $s='';
open F, $f;
$s = minify(input => *F);
close F;
open F, ">$f";
print F $s;
close F;
}
#!/usr/bin/perl -Iscripts
use JavaScript::Minifier 'minify';
foreach my $f (@ARGV) {
unless(-e $f) {
print STDERR "$f doesn't exists, skipping\n";
next;
}
unless(-w $f) {
print STDERR "$f is not writeable, skipping\n";
next;
}
my $s='';
open F, $f;
$s = minify(input => *F);
close F;
open F, ">$f";
print F $s;
close F;
}
#!/usr/bin/perl
use strict;
our $cond = 1;
our %args;
for ( my $i = 0 ; $i < @ARGV ; $i += 2 ) {
$args{ $ARGV[$i] } =
( $ARGV[ $i + 1 ] and $ARGV[ $i + 1 ] ne 'no' ) ? 1 : 0;
}
while (<STDIN>) {
if (m#//endif#) {
$cond = 1;
}
elsif (m#//else#) {
$cond = !$cond;
}
elsif (m#//if:(\w+)#) {
$cond = $args{$1};
}
else {
print if ($cond);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment