Skip to content

Commit

Permalink
Made compile.pl compatible with gulp configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
imrahil committed May 9, 2016
1 parent 46695ed commit fe288f9
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 43 deletions.
8 changes: 5 additions & 3 deletions compile.pl
Expand Up @@ -8,6 +8,9 @@
# Get the template file
my $template = read_file("templates/index.tpl");

# Remove mocks
$template =~ s/<!--removeIf.*-->(.|\n)*<!--endRemoveIf.*-->//s;

# Find and replace
my @replaced;
for my $to_replace ( split("\n", $template) ){
Expand All @@ -20,9 +23,8 @@
my $url = $element->attr("href");
print "found '$url'\n";
push @replaced, "<style rel='" . $element->attr("rel") . "'>\n" . read_file("$url") . "\n</style>\n";
}elsif( $to_replace =~ m{link.*(static|src).*html} ){
my $element = HTML::TreeBuilder->new_from_content( $to_replace )->look_down( _tag => "link", href => qr/(static|src)/ );
my $url = $element->attr("href");
}elsif( $to_replace =~ m/\@\@include\('(.*html)/ ){
my $url = $1;
print "found '$url'\n";
push @replaced, "\n" . read_file("$url") . "\n";
}else{
Expand Down

0 comments on commit fe288f9

Please sign in to comment.