diff --git a/.gitignore b/.gitignore index e91fdf6..35df087 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ build-config.cfg +composer.lock src/style.css src/style.css.map -src/scss/.sass-cache \ No newline at end of file +src/scss/.sass-cache/ +src/vendor/ +vendor/ \ No newline at end of file diff --git a/build.sh b/build.sh index a354f3d..859a29d 100755 --- a/build.sh +++ b/build.sh @@ -2,14 +2,23 @@ source build-config.cfg +## Install composer dependencies +composer install + ## Compile SASS sh compile-sass.sh -## Install composer dependencies -## composer install - -echo "Updating files in $destination" +echo "Updating files of theme" rm -rf $destination mkdir $destination cp -R src/* $destination/ + +##Removendo o arquivo sass rm -rf $destination/scss + +##Bootstrap +mkdir $destination/vendor/bootstrap/css +cp $destination/vendor/bootstrap/scss/bootstrap.min.css $destination/vendor/bootstrap/css +rm -rf $destination/vendor/bootstrap/scss + +echo "Finish!!" \ No newline at end of file diff --git a/compile-sass.sh b/compile-sass.sh old mode 100644 new mode 100755 index 938ef38..e09854f --- a/compile-sass.sh +++ b/compile-sass.sh @@ -2,15 +2,22 @@ # Executa o comando 'sass' para verificar se existe (veja http://stackoverflow.com/a/677212/329911) command -v sass >/dev/null 2>&1 || { - echo >&2 "SASS parece não está disponivel."; + echo >&2 "SASS does not seem to be available."; exit 1; } # Define o caminho. -echo "Compilando Sass..." -cd src/scss - -sass -E 'UTF-8' style.scss:../style.css +echo "Compiling Sass..." -echo "Compilação do Sass Concluído!" +#Bootstrap +cd src/vendor/bootstrap/scss +sass bootstrap.scss:bootstrap.min.css --style compressed + +#Style do Tema +cd ../../../scss +sass -E 'UTF-8' style.scss:../style.css +cd .. +rm -rf style.css.map + +echo "Sass compilation Completed!" exit 0 diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..aa07d55 --- /dev/null +++ b/composer.json @@ -0,0 +1,15 @@ +{ + "repositories":[ + { + "type":"composer", + "url":"https://wpackagist.org" + } + ], + "require": { + "twbs/bootstrap": "4.0.0" + }, + "scripts": { + "post-install-cmd": "bash install.sh", + "post-update-cmd": "bash install.sh" + } +} diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..666eb6a --- /dev/null +++ b/install.sh @@ -0,0 +1,42 @@ +#!/bin/bash +php -r ' +echo "\n ..::Tainacan Theme::..\n"; + +echo "\nStarting installation with composer ... please wait!!"; + +echo "\nChecking if project folders exist ...\n\n"; + +if (!file_exists("vendor/bootstrap")) { + mkdir("src/vendor/bootstrap/", 0777, true); + mkdir("src/vendor/bootstrap/scss", 0777, true); + mkdir("src/vendor/bootstrap/js", 0777, true); +} + +echo "\nVerification completed...\n"; + +echo "\nStarting Copying Files...\n"; + +echo "...Bootstrap\n"; +if (!file_exists("src/vendor/bootstrap/scss/bootstrap.scss")) { + recurse_copy("vendor/twbs/bootstrap/scss", "src/vendor/bootstrap/scss"); + copy("vendor/twbs/bootstrap/dist/js/bootstrap.min.js", "src/vendor/bootstrap/js/bootstrap.min.js"); +} + +echo "Finish!\n\n"; + +function recurse_copy($src,$dst) { + $dir = opendir($src); + @mkdir($dst); + while(false !== ( $file = readdir($dir)) ) { + if (( $file != "." ) && ( $file != ".." )) { + if ( is_dir($src . "/" . $file) ) { + recurse_copy($src . "/" . $file,$dst . "/" . $file); + } + else { + copy($src . "/" . $file,$dst . "/" . $file); + } + } + } + closedir($dir); +} +' \ No newline at end of file diff --git a/src/functions.php b/src/functions.php new file mode 100644 index 0000000..a1df31c --- /dev/null +++ b/src/functions.php @@ -0,0 +1,41 @@ +