Skip to content

Commit

Permalink
feat: add optimized fonts - react initially
Browse files Browse the repository at this point in the history
  • Loading branch information
lakardion committed Sep 6, 2024
1 parent 99eb831 commit 9a5e95f
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 4 deletions.
25 changes: 24 additions & 1 deletion hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,22 @@ def remove_expo_yaml_files():
remove(file_name)


def add_fonts_to_web():
move(join("resources", "web", "fonts"), join("client", "src", "assets"))


def clean_up_web_resources():
rmtree(join("resources", "web"))


def add_fonts_to_mobile():
move(join("resources", "mobile", "fonts"), join("mobile", "assets"))


def clean_up_mobile_resources():
rmtree(join("resources", "mobile"))


def set_keys_in_envs(django_secret, postgres_secret):
env_file_path = join(".env.example")
pull_request_template_path = join(".github", "pull_request_template.md")
Expand Down Expand Up @@ -150,22 +166,29 @@ def get_secrets():
def main():
django_secret, postgres_secret = get_secrets()
set_keys_in_envs(django_secret, postgres_secret)

has_web = "{{ cookiecutter.client_app }}".lower() == "vue3" or "{{ cookiecutter.client_app }}".lower() == "react"
if "{{ cookiecutter.client_app }}".lower() == "none":
rmtree(web_clients_path)
remove(join("package.json"))
elif "{{ cookiecutter.client_app }}".lower() == "vue3":
remove_web_client_files("react")
move_web_client_to_root("vue3")
# add_fonts_to_web()
elif "{{ cookiecutter.client_app }}".lower() == "react":
remove_web_client_files("vue3")
move_web_client_to_root("react")
# add_fonts_to_web()
if has_web:
add_fonts_to_web()
if "{{ cookiecutter.include_mobile }}".lower() == "y":
move_mobile_client_to_root("react-native")
add_fonts_to_mobile()
else:
remove_expo_yaml_files()

clean_up_clients_folder()
clean_up_mobile_resources()
clean_up_web_resources()

print_thankyou()
print(f"\n{SUCCESS}Awesome! Project initialized...{END}\n")
Expand Down
20 changes: 20 additions & 0 deletions {{cookiecutter.project_slug}}/clients/web/react/src/index.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
@font-face {
font-family: 'Montserrat';
font-display: swap;
font-style: italic;
src:
url('assets/fonts/montserrat-italic-variable.woff2') format('woff2'),
url('assets/fonts/montserrat-italic-variable.woff') format('woff');
}

@font-face {
font-family: 'Montserrat';
font-display: swap;
font-style: normal;
src:
url('assets/fonts/montserrat-variable.woff2') format('woff2'),
url('assets/fonts/montserrat-variable.woff') format('woff');
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
const { colors } = require('./tailwind.colors')
const defaultTheme = require('tailwindcss/defaultTheme')

/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
theme: {
extend: {
colors,
fontFamily: {
avenir: ['Avenir', 'Helvetica', 'Arial', 'sans-serif'],
},
fontFamily: { sans: ['Montserrat', ...defaultTheme.fontFamily.sans] },
},
container: {
padding: {
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 9a5e95f

Please sign in to comment.