diff --git a/build.sh b/build.sh index d3902a4..dde36b6 100755 --- a/build.sh +++ b/build.sh @@ -31,18 +31,29 @@ for locale in "${locales[@]}"; do # for each file other than index.html, put a proper link back to the main page find ./ -not -name "index.html" -name "*.html" -exec sed -E -i "s/\"(\.\.\/)?$locale\.html/\"\1index.html/g" {} \+ - # repair the links of the footer locale switcher - # for each line with data-lang-switch="{locale}" replace the href with the link to /{locale}/path... - # attempt to do with pipe failed, so I use a non optimal for loop - # find ./ -name "*.html" -exec sh -c 'sed -E -i "s/data-lang-switch=\"([a-z]{2})\".+href\=\".*\"/href\=\"\/\1\/{}\"/g" {}' \; - for path in $(find ./ -name "*.html"); do - pathM=`echo $path | cut -c 3-` - sed -E -i "s%data-lang-switch=\"([a-z]{2})\".+href\=\".*\"%href\=\"/\1/$pathM\"%g" $path - done cd .. done +# repair the links of the footer locale switcher +# for each line with data-lang-switch="{locale}" replace the href with the link to /{locale}/path... +# attempt to do with pipe failed, so I use a non optimal for loop +# find ./ -name "*.html" -exec sh -c 'sed -E -i "s/data-lang-switch=\"([a-z]{2})\".+href\=\".*\"/href\=\"\/\1\/{}\"/g" {}' \; +for path in $(find ./ -name "*.html"); do + pathM=`echo $path | cut -c 6-` + sed -E -i "s%data-lang-switch=\"([a-z]{2})\".+href\=\".*\"%href\=\"/\1/$pathM\"%g" $path +done + +# remove assets +rm -r *.woff dist imgs +find ./ -name '*.orig' -delete + +# change the path of all assets +find ./ -name "*.html" -exec sed -E -i "s%\"\.\./dist/%\"/dist/%g; s%\"dist/%\"/dist/%g; s%\"\.\./imgs/%\"/imgs/%g; s%\"imgs/%\"/imgs/%g" {} \+ + + +cp -r ../public/* ./ +rm index.php kill $phpPID diff --git a/templates/layout.html.twig b/templates/layout.html.twig index dc93205..63251bc 100644 --- a/templates/layout.html.twig +++ b/templates/layout.html.twig @@ -13,8 +13,7 @@ - - +