Create Nodelessness repository

The purpose of this repo is to _eventually_ create a basic structure for
web development projects that do not rely on Nodejs.

This is a work in progress.  Do not expect things to work just yet.

The code herein is copied from my website's source:
https://gitlab.com/protesilaos/protesilaos.gitlab.io
parents
This diff is collapsed.
Rudimentary framework for the nodeless web dev
==============================================
This is a skeleton of a repository for a web development workflow that
has no dependency on Nodejs.
WORK IN PROGRESS.
#!/bin/bash
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Description {{{
# ---------------
#
# This script generates a favicon.ico and places it at the root of the
# project's directory. Web browsers can pick up that file even without
# being told to do so in the HTML head.
#
# To generate the favicon.ico, this script will first create a set of
# smaller .png files from a base image. It will then optimise and
# combine them into the end product.
#
# Debian Buster dependencies:
#
# apt install git imagemagick optipng
#
# This script is part of a broader effort to remove nodejs from my
# workflow when developing my website.
#
# My site and its source code:
# * https://protesilaos.com/
# * https://gitlab.com/protesilaos/protesilaos.gitlab.io
#
# }}}
# The project is controlled with git. Else throw an error and exit.
if [ -x /usr/bin/git ]; then
project_root_dir="$(git rev-parse --show-toplevel)"
else
echo "ERROR. Missing dependency: git"
echo "Exiting"
exit 1
fi
if [ -d "$project_root_dir/_src/favicons" ]; then
favicons_source_path="$project_root_dir/_src/favicons"
else
echo "ERROR: Missing directory: $project_root_dir/_src/favicons"
echo "Exiting"
exit 1
fi
if [ -f "$favicons_source_path/favicon_260x260.png" ]; then
master_favicon="$favicons_source_path/favicon_260x260.png"
else
echo "ERROR: Missing master favicon file: $favicons_source_path/favicon_260x260.png"
echo "Exiting"
exit 1
fi
# Define the array with the desired image sizes.
favicon_sizes=(16x16 32x32)
####favicon_sizes=(16x16 24x24 32x32 48x48 64x64)
# We will be populating the list of resized icons in the loop below…
resized_favicons=()
for i in "${favicon_sizes[@]}"; do
# First create the smaller images.
convert -resize $i $master_favicon $favicons_source_path/favicon_resized_${i}.png
# Populate the list of resized favicons
resized_favicons+=("$favicons_source_path/favicon_resized_$i.png")
done
# Optimise the resized files
for i in "${resized_favicons[@]}"; do
optipng -quiet "$i"
done
# Combine the resized favicons into a single .ico file.
convert "${resized_favicons[@]}" "$project_root_dir/favicon.ico"
# Update the favicon version in the HTML head (force cache refresh).
sed -i "s,favicon.ico?v=[a-zA-Z0-9]*,favicon.ico?v=$(date +%Y%m%d%H%M)," \
"$project_root_dir/_includes/head.html"
# vi:foldmethod=marker
#!/bin/bash
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Description {{{
# ---------------
#
# Convert TTF font files to WOFF and WOFF2 and move them to the desired
# directory inside my website's source code.
#
# First check the 'subset_fonts.sh' before running this script. That is
# what reduces the source files to the Unicode range required for use on
# my website.
#
# Debian Buster dependencies:
#
# apt install git sfnt2woff-zopfli woff2
#
# This script is part of a broader effort to remove nodejs from my
# workflow when developing my website.
#
# My site and its source code:
# * https://protesilaos.com/
# * https://gitlab.com/protesilaos/protesilaos.gitlab.io
#
# }}}
# Our project is controlled with git. Else throw an error and exit.
if [ -x /usr/bin/git ]; then
project_root_dir="$(git rev-parse --show-toplevel)"
else
echo "ERROR. Missing dependency: git"
echo "Exiting"
exit 1
fi
# These are specific to my own website's repo. Adapt accordingly. The
# paths are assumed to exist, so no further logic is added for the
# occasion where they might not.
#
# NOTE source path can have per-font-family subdirectories. Whereas
# output files should all just be placed in the designated path, without
# any filesystem differentiation between font families.
if [ -d "$project_root_dir/_src/ttf" ]; then
fonts_source_path="$project_root_dir/_src/ttf"
fonts_output_path="$project_root_dir/assets/fonts"
else
echo "ERROR: Missing directory: $project_root_dir/_src/ttf"
echo "Exiting"
exit 1
fi
# Convert the font files to WOFF and WOFF2 formats (web fonts)
find "$fonts_source_path" -name '*.subset.ttf' -print0 | while IFS= read -r -d $'\0' line; do
sfnt2woff-zopfli "$line"
woff2_compress "$line"
done
# Move the web fonts to their right location
find "$fonts_source_path" -name '*.subset.woff*' -print0 | while IFS= read -r -d $'\0' line; do
mv "$line" "$fonts_output_path/"
done
# vi:foldmethod=marker
#!/bin/bash
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Minify and concatenate the _src/css/_*.css. These files are bundled
# into a single file, _src/css/webfonts.scss, via the `@import`
# directive. We only need to operate on that file.
#
# Dependencies on Debian Buster:
# apt install git sassc
#
# This script is part of a broader effort to remove nodejs from my
# workflow when developing my website.
#
# My site and its source code:
# * https://protesilaos.com/
# * https://gitlab.com/protesilaos/protesilaos.gitlab.io
# This assumes our project is controlled with git
if [ -x /usr/bin/git ]; then
project_root_dir="$(git rev-parse --show-toplevel)"
else
echo "ERROR. Missing dependency: git"
echo "Exiting"
exit 1
fi
# These are specific to my own website's repo. Adapt accordingly.
if [ -d "$project_root_dir/_src/css" ]; then
webfonts_source_path="$project_root_dir/_src/css/webfonts.scss"
else
echo "ERROR: Missing directory: $project_root_dir/_src/css"
echo "Exiting"
exit 1
fi
if [ -d "$project_root_dir/assets/css" ]; then
webfonts_output_path="$project_root_dir/assets/css/webfonts.min.css"
else
echo "ERROR: Missing directory: $project_root_dir/assets/css"
echo "Exiting"
exit 1
fi
if [ -x /usr/bin/sassc ]; then
echo "Preparing to minify webfonts…"
echo "This repo's root directory is:"
echo "$project_root_dir"
echo "Source file at $webfonts_source_path"
echo "Output file at $webfonts_output_path"
sassc --style compressed "$webfonts_source_path" "$webfonts_output_path"
echo "Job done!"
else
echo "ERROR. Missing dependency: sassc"
echo "Exiting"
exit 1
fi
#!/bin/bash
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Run all the local scripts for building the web fonts. See the
# individual scripts for dependencies and documentation.
#
# This script is part of a broader effort to remove nodejs from my
# workflow when developing my website.
#
# My site and its source code:
# * https://protesilaos.com/
# * https://gitlab.com/protesilaos/protesilaos.gitlab.io
# The project is controlled with git. Else throw an error and exit.
if [ -x /usr/bin/git ]; then
project_root_dir="$(git rev-parse --show-toplevel)"
else
echo "ERROR. Missing dependency: git"
echo "Exiting"
exit 1
fi
. "$project_root_dir/dev/subset_ttf.sh"
. "$project_root_dir/dev/create_webfonts.sh"
. "$project_root_dir/dev/minify_webfonts_css.sh"
#!/bin/bash
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Description {{{
# ---------------
#
# This is a script that extracts ("subsets") a defined range of Unicode
# points from a *.ttf font file. It removes all glyphs that are not
# part basic latin and greek subsets, the latin1-supplement, numerals
# and punctuation marks. for use on the web. For the complete Unicode
# character table and code points, see: https://unicode-table.com
#
# Another script handles the conversion to file formats that are
# appropriate for the Web (part of the same source---see below):
# create_webfonts.sh
#
# Debian Buster dependencies:
#
# apt install git fonttools
#
# This script is part of a broader effort to remove nodejs from my
# workflow when developing my website.
#
# My site and its source code:
# * https://protesilaos.com/
# * https://gitlab.com/protesilaos/protesilaos.gitlab.io
#
# }}}
# The project is controlled with git. Else throw an error and exit.
if [ -x /usr/bin/git ]; then
project_root_dir="$(git rev-parse --show-toplevel)"
else
echo "ERROR. Missing dependency: git"
echo "Exiting"
exit 1
fi
# These are specific to my own website's repo. Adapt accordingly. The
# paths are assumed to exist, so no further logic is added for the
# occasion where they might not.
#
# NOTE source path can have per-font-family subdirectories. Whereas
# output files should all just be placed in the designated path, without
# any filesystem differentiation between font families.
if [ -d "$project_root_dir/_src/ttf" ]; then
fonts_source_path="$project_root_dir/_src/ttf"
else
echo "ERROR: Missing directory: $project_root_dir/_src/ttf"
echo "Exiting"
exit 1
fi
# This function accepts the path to the *.ttf file as a single argument.
# To learn more about pyftsubset, run it with --help
subset_font() {
pyftsubset "$1" \
--unicodes='U+0020-007E,U+00A1-00FF,\
U+0370-03CE,U+2010,U+2012-2014,U+2018-201F,U+2022-2027' \
--layout-features=''
}
# Remove older files that were generated by this script
find "$fonts_source_path" -name '*subset.ttf' -print0 | while IFS= read -r -d $'\0' line; do
rm "$line"
done
# Find all the font files and subset them. The new files have ".subset"
# prepended to their file type suffix. Example: Hack-Regular.ttf =>
# Hack-Regular.subset.ttf
find "$fonts_source_path" -name '*.ttf' -print0 | while IFS= read -r -d $'\0' line; do
subset_font "$line"
done
# vi:foldmethod=marker
@font-face {
font-family: 'FiraGO';
font-style: normal;
font-weight: 400;
src: local('FiraGO Regular'), local('FiraGO-Regular'),
url('../assets/fonts/FiraGO-Regular.subset.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
url('../assets/fonts/FiraGO-Regular.subset.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}
@font-face {
font-family: 'FiraGO';
font-style: italic;
font-weight: 400;
src: local('FiraGO Italic'), local('FiraGO-Italic'),
url('../assets/fonts/FiraGO-Italic.subset.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
url('../assets/fonts/FiraGO-Italic.subset.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}
@font-face {
font-family: 'FiraGO';
font-style: normal;
font-weight: 700;
src: local('FiraGO Bold'), local('FiraGO-Bold'),
url('../assets/fonts/FiraGO-Bold.subset.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
url('../assets/fonts/FiraGO-Bold.subset.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}
@font-face {
font-family: 'FiraGO';
font-style: italic;
font-weight: 700;
src: local('FiraGO Bold Italic'), local('FiraGO-BoldItalic'),
url('../assets/fonts/FiraGO-BoldItalic.subset.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
url('../assets/fonts/FiraGO-BoldItalic.subset.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}
@font-face {
font-family: 'Hack alt';
font-style: normal;
font-weight: 400;
src: local('Hack Regular'), local('Hack-Regular'),
url('../assets/fonts/Hack-Regular.subset.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
url('../assets/fonts/Hack-Regular.subset.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}
//// @font-face {
//// font-family: 'Hack alt';
//// font-style: italic;
//// font-weight: 400;
//// src: local('Hack Italic'), local('Hack-Italic'),
//// url('../assets/fonts/Hack-Italic.subset.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
//// url('../assets/fonts/Hack-Italic.subset.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
//// }
////
//// @font-face {
//// font-family: 'Hack alt';
//// font-style: normal;
//// font-weight: 700;
//// src: local('Hack Bold'), local('Hack-Bold'),
//// url('../assets/fonts/Hack-Bold.subset.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
//// url('../assets/fonts/Hack-Bold.subset.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
//// }
////
//// @font-face {
//// font-family: 'Hack alt';
//// font-style: italic;
//// font-weight: 700;
//// src: local('Hack Bold Italic'), local('Hack-BoldItalic'),
//// url('../assets/fonts/Hack-BoldItalic.subset.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
//// url('../assets/fonts/Hack-BoldItalic.subset.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
//// }
@import 'firago';
@import 'hack';
Digitized data copyright 2012-2018 for FiraGO: Carrois Corporate GbR and HERE Europe B.V. All rights reserved.
Digitized data copyright 2012-2018 for Fira Sans up to version 4.3: The Mozilla Foundation, Telefonica S.A., Carrois Corporate GbR and bBox Type GmbH.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
MIT License
===========
Copyright (c) 2018 Source Foundry Authors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Hack font with alternative glyphs
=================================
These font files include a patched build of the *Hack* font. The
glyphs I have changed are the following:
- [(](https://github.com/source-foundry/alt-hack/tree/master/glyphs/u0028-curved).
- [)](https://github.com/source-foundry/alt-hack/tree/master/glyphs/u0029-curved).
- [0](https://github.com/source-foundry/alt-hack/tree/master/glyphs/u0030-forwardslash).
- [3](https://github.com/source-foundry/alt-hack/tree/master/glyphs/u0033-flattop).
Resources used:
- The [alt-hack](repository https://github.com/source-foundry/alt-hack).
- The [official build instructions](https://github.com/source-foundry/Hack/blob/master/docs/BUILD.md).
License
-------
This work is licensed under the MIT License, which is taken directly
from the "alt-hack" repository. See the LICENSE.md bundled with this
font set.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment