Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update config and add scripts/lib folder #32

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lucasvallenet
Copy link
Contributor

Update the config file :

Remove unused CUSTOM_EVENTS object.
Add environment variables IS_DEV and IS_PROD

Add /lib folder :

Add @scripts/lib folder to import libraries and settings within this folder (like gsap).

Here is an example file for @scripts/lib/gsap.ts

import { gsap } from 'gsap'

const DURATION_DEFAULT = 0.5;
const DURATION_SLOW = 0.75;
const EASE_OUT = 'power2.out';
const EASE_IN = 'power2.in';
const EASE_IN_OUT = 'power2.inOut';

// GSAP defaults
gsap.defaults({
    duration: DURATION_DEFAULT,
    ease: EASE_OUT,
});

export {
    DURATION_DEFAULT,
    DURATION_SLOW,
    EASE_OUT,
    EASE_IN,
    EASE_IN_OUT,
    gsap,
};

Copy link

vercel bot commented Nov 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
astro-boilerplate ✅ Ready (Inspect) Visit Preview Nov 4, 2024 1:47pm

Copy link
Member

@mcaskill mcaskill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be just simpler to use import.meta.env.* directly?

@Jerek0 Jerek0 self-requested a review November 4, 2024 15:15
@Jerek0
Copy link
Member

Jerek0 commented Nov 6, 2024

Would it be just simpler to use import.meta.env.* directly?

I get @mcaskill's point but at the same time it may be easier to remember & to read?

/lib folder

I like the idea of a space for library specific settings! 👍

But how would we use it exactly? I know it's just an example but in order to make sure those default GSAP settings are executed, would we have to import the lib this way in our components?

-import { gsap } from 'gsap'
+import { gsap } from '@scripts/lib/gsap'

That sounds reasonable, we'd just have to get used to it.
Or would we have to include it in app.ts first and then we could import it like we're used to? (meh)

@lucasvallenet
Copy link
Contributor Author

lucasvallenet commented Nov 11, 2024

Would it be just simpler to use import.meta.env.* directly?

I get @mcaskill's point but at the same time it may be easier to remember & to read?

/lib folder

I like the idea of a space for library specific settings! 👍

But how would we use it exactly? I know it's just an example but in order to make sure those default GSAP settings are executed, would we have to import the lib this way in our components?

-import { gsap } from 'gsap'
+import { gsap } from '@scripts/lib/gsap'

That sounds reasonable, we'd just have to get used to it. Or would we have to include it in app.ts first and then we could import it like we're used to? (meh)

We only need to import the @scripts/lib/gsap to make it work.
No need to import it globally first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants