diff --git a/.env b/.env new file mode 100644 index 0000000..9903255 --- /dev/null +++ b/.env @@ -0,0 +1,5 @@ +BROWSERSYNC_PROXY_URL=http://tofino.test +THEME_PATH=/wp-content/themes/tofino +DEPLOYMENT_PATH= +SSH_LOGIN= +DEPLOY=FALSE \ No newline at end of file diff --git a/.env.example b/.env.example deleted file mode 100644 index 19baf21..0000000 --- a/.env.example +++ /dev/null @@ -1,2 +0,0 @@ -BROWSERSYNC_PROXY_URL=http://tofino.test -THEME_PATH=/wp-content/themes/tofino/ \ No newline at end of file diff --git a/.git-ftp-ignore b/.git-ftp-ignore new file mode 100644 index 0000000..863c511 --- /dev/null +++ b/.git-ftp-ignore @@ -0,0 +1,25 @@ +src +node_modules +.vscode +.editorconfig +.env +.git +.github +.gitignore +.gitkeep +.git-ftp-ignore +.git-ftp-include +.gitattributes +.gitignore +.babelrc +.stylelintrc.js +.prettierrc.js +.eslintrc.js +postcss.config.js +composer.json +composer.lock +package.json +package-lock.json +tailwind.config.js +webpack.mix.js +*.md \ No newline at end of file diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml new file mode 100644 index 0000000..862d4a9 --- /dev/null +++ b/.github/workflows/dev.yml @@ -0,0 +1,63 @@ +name: Development Build + +on: + push: + branches: [dev] + +jobs: + build: + runs-on: ubuntu-latest + defaults: + run: + shell: bash + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 2 + + - name: Get Composer Cache Directory + id: composer-cache + run: | + echo "::set-output name=dir::$(composer config cache-files-dir)" + - uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + + - name: Install Composer Dependencies + run: composer install -o + + - name: Get NPM Cache Directory + uses: actions/cache@v2 + with: + path: '~/.npm' + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Install NPM Dependencies + run: npm install + + - name: Build Dev Scripts + run: npm run dev + + - name: Get .env Variables + id: dotenv + uses: falti/dotenv-action@v0.2.7 + + - name: Sync Files to Server + env: + dest: '${{ steps.dotenv.outputs.SSH_LOGIN }}:${{ steps.dotenv.outputs.DEPLOYMENT_PATH }}${{ steps.dotenv.outputs.THEME_PATH }}' + deploy: '${{ steps.dotenv.outputs.DEPLOY }}' + if: ${{ env.deploy == 'TRUE' }} + run: | + echo "${{secrets.DEPLOY_KEY}}" > deploy_key + chmod 600 ./deploy_key + rsync -chav --delete \ + -e 'ssh -i ./deploy_key -o StrictHostKeyChecking=no' \ + --exclude-from='.git-ftp-ignore' \ + --exclude /deploy_key \ + ./ ${{env.dest}} diff --git a/.gitignore b/.gitignore index 341da5b..445c2db 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,8 @@ !.env !.prettierrc.js !.babelrc -!.env.example +!.git-ftp-ignore +!.github # ignore node/grunt dependency directories node_modules/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ccf152..c0de87e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ +# 3.2.2: (2021-10-10) + +### Features + +- Add auto build & deploy Github action. Fixes [#312](https://github.com/creativedotdesign/tofino/issues/312). ([45f032](https://github.com/creativedotdesign/tofino/commit/45f032f8b39c8d9505a45fa57eba93de2bd3aa85)) +- Add body open hook for GTM script. Fixes [#326](https://github.com/creativedotdesign/tofino/issues/326). ([2a4e092](https://github.com/creativedotdesign/tofino/commit/2a4e09267affcfa5ecbf84cb9f073b26dcf69a85)) + +### Bug Fixes + +- Update PHP min version. ([e7afd8](https://github.com/creativedotdesign/tofino/commit/e7afd841cca824d28ac3c93adf8c2599f22679ee)) +- Update Tailwind Purge Paths Fixes [#323](https://github.com/creativedotdesign/tofino/issues/323). ([ebf510](https://github.com/creativedotdesign/tofino/commit/ebf510302fdd1a79cb226d990d372b9a4acb831c)) +- Correct paths & add prefetch scripts. Fixes [#322](https://github.com/creativedotdesign/tofino/issues/322). ([c0f50a0](https://github.com/creativedotdesign/tofino/commit/c0f50a013407760bf3e199de18f735c30e892125)) +- Update menu class filter, fixes [#324](https://github.com/creativedotdesign/tofino/issues/324) & [#301](https://github.com/creativedotdesign/tofino/issues/301). ([4dc9638](https://github.com/creativedotdesign/tofino/commit/4dc963865240f0be8d4f92f7a80655f74f851177)) +- Add back in Fragment Cache script. Fixes [#325](https://github.com/creativedotdesign/tofino/issues/325). ([3933403](https://github.com/creativedotdesign/tofino/commit/39334032db792625172db73b9cbc51d8e1871596)) + # 3.2.1: (2021-09-26) ### Style diff --git a/README.md b/README.md index 32ec9af..a4441ef 100644 --- a/README.md +++ b/README.md @@ -73,33 +73,35 @@ We use [GitHub Actions](https://github.com/features/actions). The deployment scr ``` composer install npm install -npm run prod +npm run dev ``` The following files and directories should not be deployed on the server: ``` -.babelrc +src +node_modules +.vscode .editorconfig .env .git .github -.eslintrc.js .gitignore .gitkeep .git-ftp-ignore .git-ftp-include .gitattributes .gitignore -.prettierrc.js +.babelrc .stylelintrc.js -assets -node_modules +.prettierrc.js +.eslintrc.js +postcss.config.js composer.json composer.lock package.json package-lock.json tailwind.config.js webpack.mix.js -**/*.md +*.md ``` diff --git a/functions.php b/functions.php index 35d8d1c..bcbaf18 100644 --- a/functions.php +++ b/functions.php @@ -14,6 +14,7 @@ "inc/lib/helpers.php", "inc/lib/clean.php", "inc/lib/CustomizrTextEditor.php", + "inc/lib/FragmentCache.php", "inc/shortcodes/copyright.php", "inc/shortcodes/social-icons.php", "inc/shortcodes/svg.php", @@ -104,4 +105,21 @@ function acf_json_load_point($paths) { * Turn off YYYY/MM Media folders * */ -add_filter('option_uploads_use_yearmonth_folders', '__return_false', 100); \ No newline at end of file +add_filter('option_uploads_use_yearmonth_folders', '__return_false', 100); + + +/** + * Prefetch_scripts that might be needed later + * + * @since 3.3.0 + */ +function prefetch_scripts() { + $scripts = [ + // Add scripts here + ]; + + foreach ($scripts as $script) { + echo ''; + } +} +add_action('wp_head', 'prefetch_scripts'); diff --git a/header.php b/header.php index e8c7434..07e6967 100644 --- a/header.php +++ b/header.php @@ -11,6 +11,8 @@
> + +' . __('PHP version >= 7.2.0 is required for this theme to work correctly.', 'tofino') . '
' . __('PHP version >= 7.3.0 is required for this theme to work correctly.', 'tofino') . '