hugosoucycc

[ARCHIVED] Another old source code of <hugo.soucy.cc>.
Log | Files | Refs | Submodules

commit 801487dbb0f219cccc8fe8e0e2db8712edb2ceed
parent 7f0212d0e821f09a9e8de2aa6b947242a137fd50
Author: Hugo Soucy <hugo.soucy@savoirfairelinux.com>
Date:   Sun,  5 Mar 2017 19:55:09 -0500

Add a watch task for the CSS and JS files.

Diffstat:
Mmanuelfile | 47++++++++++++++++++++++++++++++++++++-----------
1 file changed, 36 insertions(+), 11 deletions(-)

diff --git a/manuelfile b/manuelfile @@ -1,8 +1,14 @@ #!/bin/bash +# Dependencies : +# - https://github.com/ShaneKilkelly/manuel +# - https://github.com/ShaneKilkelly/manuel-contrib-watch + +# $HOME/.manuel.d/plugins/manuel-contrib-watch load_plugin manuel-contrib-watch -# Run this task with: $ manuel build +# Concatenate and minify assets +# Then build the static site function build () { ./frontend @@ -18,21 +24,40 @@ function build () { echo "- hugosoucycc is builded!" } -# Run this task with: $ manuel deploy +# Build the static site +# Then deploy it to the web server function deploy () { build - - ./deploy - + + ./deploy + echo "- ... and deployed!" } -# Watch -function wait_for_change { +# Concatenate and minify styles sheets +# Then export with rsync +function update_css () { + ./frontend + + rsync -avmh "./static/prod/css/" "./public_html/css/" +} + +# Concatenate and minify scripts +# Then export with rsync +function update_js () { + ./frontend + + rsync -avmh "./static/prod/js/" "./public_html/js/" +} + +# Watch CSS and JS files +# Then update them +function watch_assets_change () { - declare -A actions=( - [".*\.css$"]="echo 'we should concat and minify the js again'" - ) + declare -A actions=( + [".*.css$"]="update_css" + [".*.js$"]="update_js" + ) - manuel_watch . + manuel_watch "./static/dev/" }