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

docs: Add example for auto-reloading css #91

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

Conversation

FjedorGaede
Copy link

While migrating to the v2 I noticed that the example from the original documentation on how to make auto-reloading of SCSS and CSS work was missing in the documentation. As I rely on it heavily and think it increases the DX alot - especially for new users - , it should be added to the documentation. The example I provided is the one that is running on my machine and works as expected. WDYT?

  • Fjedor

Copy link
Contributor

@danielwerg danielwerg left a comment

Choose a reason for hiding this comment

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

This project uses 4 spaces and doesn't use semicolons, we should keep styling consistent across entire project.

@FjedorGaede FjedorGaede force-pushed the autoreload-scss-documentation branch 2 times, most recently from 49366e1 to de0508d Compare November 16, 2024 16:39
@FjedorGaede
Copy link
Author

Yes, makes sense. Added the changes.

@danielwerg
Copy link
Contributor

Honestly hot-reloading of both scss and typescript should be built-in ags. Interested to hear what @Aylur thinks.

For now I use fd .* -E @girs | entr -crz ags run until I find better but still simple tool. Normally I would use vite in frontend project.

@Aylur
Copy link
Owner

Aylur commented Nov 16, 2024

I'll probably write a roadmap at some point, because this is a feature I have in mind.
For ags run I'm thinking of a --watch flag, but I don't think its possible to do hot module reloading like on web frameworks, at least I have no clue how it could be done, so all it would do is just restart the gjs process.
However for stylesheets it is possible. I'm thinking of doing it through dbus so all consumers of Astal.Application can benefit from it.

@Aylur
Copy link
Owner

Aylur commented Nov 16, 2024

We can merge this in the meantime though after #95 is fixed

Copy link
Contributor

@danielwerg danielwerg left a comment

Choose a reason for hiding this comment

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

few suggestions

docs/guide/typescript/theming.md Outdated Show resolved Hide resolved
docs/guide/typescript/theming.md Outdated Show resolved Hide resolved
:::code-group

```ts [app.ts]
const scss = `./style.scss` // Path to you style file
Copy link
Contributor

Choose a reason for hiding this comment

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

don't use template literals unless required (backticks)

Copy link
Contributor

Choose a reason for hiding this comment

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

const scss = `${SRC}/style.scss` 

SRC could be used

Copy link
Author

Choose a reason for hiding this comment

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

Is ${SRC} the new built-in equivalent of ${App.configDir} or is it just something the user has to set? Because I couldn't find this anywhere in the docs and thus just used ./.

Copy link

@ys5g ys5g Nov 20, 2024

Choose a reason for hiding this comment

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

EDIT: As Aylur says below, it's AGS-dependent, so it shouldn't be used here.

AGS also defines a global SRC variable which will be replaced by the value of the --src flag. By default it will point to the directory of entryfile.

Source: Bundling projects(ags docs)

Since Astal is a library it lost App.configDir.
[...]
In cases where you still have to refer to the source dir, AGS defines a global SRC variable.

Source: release notes for ags v2
Also (kind of) relevant: setting up a project(ags docs)

Copy link
Owner

Choose a reason for hiding this comment

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

Astal docs should not use AGS features as it is meant to be independent. It is a library, there is no concept of a src directory, it's the responsibility of build tools to handle that. ./ is fine for the example, it should just have a note under it like the one here

docs/guide/typescript/theming.md Show resolved Hide resolved
docs/guide/typescript/theming.md Outdated Show resolved Hide resolved
@FjedorGaede FjedorGaede force-pushed the autoreload-scss-documentation branch from de0508d to df791fd Compare November 24, 2024 20:44
@FjedorGaede
Copy link
Author

@danielwerg Good points. I pushed the changes

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.

4 participants