aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2017-07-19 11:25:13 +0100
committerDave Arter <davea@mysociety.org>2017-08-17 13:21:31 +0100
commit653d8b84d6a14f1759950e774b9b1a8bbba5f1b1 (patch)
treedd0e17c3fb5ec224d4dd16767613b83bfc92586f /bin
parentdd1cefa2d7751d3c7fb8ca4f3cb2f35efc2a8fd5 (diff)
Add make_css flag to run script after compilation
In conjunction with the --watch flag, the new --script flag can be used to run a given command after compilation caused by files changing. E.g. you could reload your browser automatically upon hitting save in your editor, with something like https://gist.github.com/davea/07a7456da15eeb8c47f1fb66e4b96c54
Diffstat (limited to 'bin')
-rwxr-xr-xbin/make_css5
1 files changed, 5 insertions, 0 deletions
diff --git a/bin/make_css b/bin/make_css
index d663597cd..7c7a5290d 100755
--- a/bin/make_css
+++ b/bin/make_css
@@ -35,6 +35,8 @@ GetOptions(
'style|t=s' => sub { die "Unknown style\n" unless $_[1] =~ /nested|expanded|compact|compressed/; $style = $_[1]; },
'verbose' => \my $verbose,
'watch' => \my $watch,
+ 'script=s'=> \my $watch_script,
+ 'script-param=s'=> \my $watch_script_param,
'help|?' => \my $help,
) or pod2usage(2);
pod2usage(1) if $help;
@@ -93,6 +95,7 @@ while ( my @events = $watcher->wait_for_events() ) {
}
}
}
+ system($watch_script, $watch_script_param) if $watch_script;
}
# Given a SCSS file, compile it and generate a .map file,
@@ -150,6 +153,8 @@ make_css [options] [dirs ...]
Options:
--verbose display more information
--watch wait for file updates and compile automatically
+ --script script to run after recompilation in watch mode
+ --script-param param to pass to --script when executing
--style, -t CSS output style (one of nested, expanded, compact, compressed)
--help this help message