|
From: <sv...@cy...> - 2016-02-19 09:01:14
|
Author: comsultia
Date: 2016-02-19 10:01:04 +0100 (Fri, 19 Feb 2016)
New Revision: 8607
Log:
Added:
trunk/frame/.bin/c3-sass
Added: trunk/frame/.bin/c3-sass
===================================================================
--- trunk/frame/.bin/c3-sass (rev 0)
+++ trunk/frame/.bin/c3-sass 2016-02-19 09:01:04 UTC (rev 8607)
@@ -0,0 +1,155 @@
+#!/usr/bin/perl
+use open ':utf8', ':std';
+use if $] < 5.018, 'encoding','utf8';
+use utf8;
+use Data::Dumper;
+use Term::ANSIColor;
+use DateTime;
+
+BEGIN
+{
+ $TOM::engine='cli';
+ $main::debug=1 if $ENV{'CYCLONE3DEBUG'};
+# $main::stdout=0 unless $ENV{'CYCLONE3DEBUG'};
+ if (!$ENV{'CYCLONE3PATH'})
+ {
+ $ENV{'CYCLONE3PATH'}="/www/TOM" if -d "/www/TOM"; # obsolete
+ $ENV{'CYCLONE3PATH'}="/Cyclone3" if -d "/Cyclone3";
+ $ENV{'CYCLONE3PATH'}="/srv/Cyclone3" if -d "/srv/Cyclone3";
+ }
+}
+END {use Inline;$SIG{__WARN__} = sub {};}
+
+our $argv=join " ",@ARGV;
+
+our $job_file;
+if ($ARGV[0] && not($ARGV[0]=~/^\-/)) # direct link to job file
+{
+ $job_file=$ARGV[0];
+ delete $ARGV[0];
+}
+
+our %arg;
+foreach my $key(@ARGV)
+{
+ $key=~s/^\-\-// && do
+ {
+ my @ref=split('=',$key,2);
+ $ref[1]=1 unless exists $ref[1];
+ if (ref($main::arg{$ref[0]}) eq "ARRAY")
+ {
+ push @{$main::arg{$ref[0]}},$ref[1];
+ }
+ elsif ($main::arg{$ref[0]})
+ {
+ my $oldval=$main::arg{$ref[0]};
+ delete $main::arg{$ref[0]};
+ $main::arg{$ref[0]}=[
+ $oldval,
+ $ref[1]
+ ];
+ }
+ else
+ {
+ $main::arg{$ref[0]}=$ref[1];
+ }
+ next;
+ };
+ $key=~s/^\-// && do
+ {
+ foreach (split('',$key)){$main::arg{$_}++;}
+ };
+}
+
+
+if ($main::arg{'v'} >= 2)
+{
+# $main::stdout=1;
+ $main::debug=1;# if ($main::arg{'v'} >= 2);
+# delete $main::arg{'v'};
+}
+
+if ($main::arg{'domain'})
+{
+ $main::arg{'domain'}=~s|^www\.||i;
+ $main::h=$main::arg{'domain'};$main::h=~s|\.|_|g;$main::h=~s|/|__|g;
+
+ my $path=$main::arg{'domain'};$path=~s|^(.[^/]*)(.*)||;
+ my $path_dom=$1;my $path_sub=$2;
+ $path_dom=~s|(.*\.\|)(.*?\..*?)$|$1|;
+ $tom::p="!$2";$path_dom=~s|\.$||;
+
+ foreach (reverse split('\.',$path_dom)){$tom::p.="/!$_";}
+ foreach (split('/',$path_sub)){$tom::p.="/$_";}
+
+ $tom::p=~s|//|/|g;
+ $tom::p=$ENV{'CYCLONE3PATH'}."/".$tom::p;
+
+ $tom::P=$tom::p;
+ delete $main::arg{'domain'};
+}
+
+require $ENV{'CYCLONE3PATH'}."/.core/.libs/TOM.pm";
+require TOM::Engine::job;
+$0.=" ".$argv if $argv;
+use open ':utf8', ':std';
+use if $] < 5.018, 'encoding','utf8';
+use utf8;
+use strict;
+use vars qw//;
+
+package main;
+use open ':utf8', ':std';
+use if $] < 5.018, 'encoding','utf8';
+use utf8;
+use strict;
+use Cwd 'abs_path';
+
+$TOM::engine_ready=1;
+
+print color 'reset';
+
+if (!keys %main::arg)
+{
+ print qq{Cyclone3 SASS processor
+Usage: c3-sass [options]
+
+Basic options:
+ --c=<compile> compile
+
+};
+ exit;
+}
+
+
+require CSS::Sass;
+
+if ($main::arg{'c'})
+{
+
+ opendir(my $dh,$tom::P.'/_dsgn/') || die "can't $!";
+ while (readdir($dh)){
+ next unless /^[^_].*\.scss$/;
+ my $shortfile=$_;$shortfile=~s|\.scss$||;
+ my $file=$tom::P."/_dsgn/".$shortfile.'.scss';
+ print "process '$file'\n";
+
+ my $sass = CSS::Sass->new(include_paths => [$tom::P.'/_dsgn/']);
+ $sass->options->{'source_map_file'} = $tom::P.'/_dsgn/'.$shortfile.'.css.map';
+ my ($css, $err, $stats) = $sass->compile_file($file);
+
+ open(HND,'>'.$tom::P.'/!media/css/'.$shortfile.'.css');
+ print HND $css;
+ close(HND);
+
+ open(HND,'>'.$tom::P.'/!media/css/'.$shortfile.'.css.map');
+ print HND $err->{'source_map_string'};
+ close(HND);
+ }
+ closedir($dh);
+
+}
+
+
+print "\n";
+1;
Property changes on: trunk/frame/.bin/c3-sass
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
|