diff --git a/Makefile b/Makefile index 44ef476a..d8a772dc 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ .DEFAULT_GOAL := start -.PHONY: start start_netlify build build_preview clean _common _build_common +.PHONY: start start-netlify netlify-build netlify-build-preview clean _common _netlify-build-common # ============================================================================== # Run Netlify in watch mode @@ -12,7 +12,8 @@ start: # -v, --verbose verbose output yarn hugo server -s site -v -start_netlify: +# Target to test netlify-cms locally +start-netlify: make _common netlify-cms-proxy-server & sleep 3 @@ -23,16 +24,16 @@ start_netlify: # ============================================================================== # Target used by Netlify to build the prod version. -build: - make _build_common +netlify-build: + make _netlify-build-common # -s, --source string filesystem path to read files relative from # -d, --destination string filesystem path to write files to # -v, --verbose verbose output yarn hugo -s site -d ../dist -v # Target used by Netlify to build his preview -build_preview: - make _build_common +netlify-build-preview: + make _netlify-build-common # -s, --source string filesystem path to read files relative from # -d, --destination string filesystem path to write files to # -D, --buildDrafts include content marked as draft @@ -41,28 +42,64 @@ build_preview: yarn hugo -s site -d ../dist -D -F -v clean: - # We should clean the repo, because Netlify does not clean the repo - # Options `-f -f` is not an error. See https://github.com/sogilis/Blog/pull/160#discussion_r422919097 - # Following is advised by GitLab CI https://docs.gitlab.com/ee/ci/yaml/#git-clean-flags + # Remove untracked files (files referenced into `.gitignore` include), + # but we exclude `node_modules`. + # Following command is advised by GitLab CI, read: + # https://docs.gitlab.com/ee/ci/yaml/#git-clean-flags git clean -f -f -d -x -e node_modules - # ============================================================================== # Private target (used by other targets above, but no sens to use outside) # ============================================================================== _common: - make clean yarn install --network-timeout 3000 --prefer-offline - yarn lint - yarn prettier:check # reboot.css + rm -f ./site/themes/sogilis/assets/css/reboot.min.css cp ./node_modules/bootstrap-reboot/dist/reboot.min.css* ./site/themes/sogilis/assets/css/ - # netlifh-cms - cp ./node_modules/netlify-cms/dist/netlify-cms.js* ./site/static/admin/ - ## fonts + # fonts + rm -rf ./site/themes/sogilis/static/css/typeface-montserrat cp -R ./node_modules/typeface-montserrat ./site/themes/sogilis/static/css/typeface-montserrat + rm -rf ./site/themes/sogilis/static/css/typeface-eb-garamond cp -R ./node_modules/typeface-eb-garamond ./site/themes/sogilis/static/css/typeface-eb-garamond + # COPY netlify-cms + rm -f ./site/static/admin/netlify-cms.js* + cp ./node_modules/netlify-cms/dist/netlify-cms.js* ./site/static/admin/ + # Remove Hugo temp files + rm -rf site/resources/ -_build_common: +_netlify-build-common: + # TESTS to know if repo is clean for build + # ========================================= +# Test if we have unstaged changes is not a necessity +# (`git clean` does not checkout them) but it's a good practice. + @if ! git diff --quiet --exit-code ; \ + then \ + >&2 echo -e "\n\n\\033[4;31mERROR:" \ + "You have changes not staged for commit" \ + "(see them thanks \`git status')." \ + "Use \`git add' to add changes into the git stagging area," \ + "or remove this changes.\\033[0m\n\n" ; \ + exit 10 ; \ + else \ + echo -e '\nCool, you have no unstaged changes\n' ; \ + fi +# Following test is needed otherwise `git clean` remove also untracked files not +# added into (.gitignore). + @if [[ "$$(git ls-files --others --exclude-standard | wc -l)" -gt 0 ]] ; \ + then \ + >&2 echo -e "\n\n\\033[4;31mERROR:" \ + "You have untracked files" \ + "not added into '.gitignore' (see them thanks \`git status')." \ + "Use \`git add' to add files into the git stagging area," \ + "or remove this files.\\033[0m\n\n" ; \ + exit 11 ; \ + else \ + echo -e "\nCool, you have no untracked files not included" \ + "into '.gitignore'\n" ; \ + fi +# We dont check if we have staged and not commited changes. + make clean make _common + yarn lint + yarn prettier:check diff --git a/package.json b/package.json index ff2e2c77..9caced86 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,8 @@ "scripts": { "start": "make start", "start:netlify": "make start_netlify", - "build": "make build", - "build:preview": "make build_preview", + "build": "make netlify-build", + "build:preview": "make netlify-build-preview", "prettier:format": "prettier --write \"{,site/**/}*.{json,ts,css,scss,yml}\"", "prettier:check": "prettier --check \"{,site/**/}*.{json,ts,css,scss,yml}\"", "lint": "eslint . --ext .js,.ts", diff --git a/site/themes/sogilis/assets/css/footer.css b/site/themes/sogilis/assets/css/footer.css index 281ac367..d29efd51 100644 --- a/site/themes/sogilis/assets/css/footer.css +++ b/site/themes/sogilis/assets/css/footer.css @@ -254,10 +254,11 @@ footer { background-color: var(--light-electric-blue); margin-left: -1.5em; - /* On boostrap, for body line-height: 1.5 */ - /* We have 1.3 + 0.2 = 1.5 */ - /* As it, the bar is on the baseline */ - /* But as the font have a height, so strange to be on the baseline */ + /* On boostrap, we have line-height: 1.5 */ + /* Therefore if we want that the hyphen has 0.4 em of blanck space at bottom */ + /* we must have a margin top of 0.9 em */ + /* We have 1.3 + 0.2 === 1.5 */ + /* And 1.3 === 0.9 + 0.4 */ height: 0.2em; margin-top: 0.9em; } diff --git a/site/themes/sogilis/layouts/partials/head.html b/site/themes/sogilis/layouts/partials/head.html index c0a5bbe1..af041184 100644 --- a/site/themes/sogilis/layouts/partials/head.html +++ b/site/themes/sogilis/layouts/partials/head.html @@ -7,6 +7,8 @@ content="{{ .Summary | default .Site.Params.SiteDescription }}" /> + +