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

move js/ into assets/js/ and make assets/ as static file server #221

Merged
merged 1 commit into from
Apr 10, 2024
Merged

move js/ into assets/js/ and make assets/ as static file server #221

merged 1 commit into from
Apr 10, 2024

Conversation

kobamkode
Copy link
Contributor

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

Problem/Feature

Move js/ into assets/js and make assets/ as a static file server, so user can easily add a custom folder like cmd/web/assets/css/ and link it into base.templ if they want it.

Description of Changes:

  • modify cmd/program/program.go to create assets/
  • modify htmx src in cmd/template/advanced/files/htmx/base.templ.tmpl
  • modify go:embed "js" to go:embed "assets"
  • modify frameworks static file routes in cmd/template/advanced/files/htmx/routes
  • modify some file tree in docs

Checklist

  • I have self-reviewed the changes being requested
  • I have updated the documentation (if applicable)

@H0llyW00dzZ
Copy link
Contributor

it's better to made it own framework I think hahahaha

@@ -2,5 +2,5 @@ package web

import "embed"

//go:embed "js"
//go:embed "assets"

Choose a reason for hiding this comment

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

doesn't this needs to be assets/*

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@H0llyW00dzZ, it sounds great!, but for now the reason is to help user who wants to add a simple custom css or add some images with just putting their folder into assets/ and load it in their templ. ❤️

@EssaAlshammri, I've test it with generating all the go-blueprint supported frameworks + htmx and the htmx is still loads and works. For your suggestion, I think I need to test it more further. Thx for reviewing my code btw. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

doesn't this needs to be assets/*

@EssaAlshammri

I've added more test stuff in file server like css file and img file with go:embed "assets" directive, it looks fine. Then I reread the embed pkg documentation, interestingly I found:

If a pattern names a directory, all files in the subtree rooted at that directory are embedded (recursively), except that files with names beginning with ‘.’ or ‘_’ are excluded.

Should I update to assets/* ?

Copy link
Contributor

Choose a reason for hiding this comment

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

@H0llyW00dzZ, it sounds great!, but for now the reason is to help user who wants to add a simple custom css or add some images with just putting their folder into assets/ and load it in their templ. ❤️

@EssaAlshammri, I've test it with generating all the go-blueprint supported frameworks + htmx and the htmx is still loads and works. For your suggestion, I think I need to test it more further. Thx for reviewing my code btw. 👍

@kobamkode
How can you design the CSS for htmx? I am so bad at designing websites, to be honest.

Copy link

@EssaAlshammri EssaAlshammri Apr 8, 2024

Choose a reason for hiding this comment

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

yeah the way you did it was right

I'm sorry it didn't work for me at first and worked when added *

but now everything is working as expected and I removed the /*

and I'm using it for tailwind styles

thanks for this I hope they consider this pr

image

@briancbarrow briancbarrow merged commit 2f34d81 into Melkeydev:main Apr 10, 2024
127 checks passed
@EssaAlshammri
Copy link

There should have been a css folder with a default css file to be easier to add styles to the web app

Or better add tailwind with the advance flag

@H0llyW00dzZ
Copy link
Contributor

H0llyW00dzZ commented Apr 11, 2024

There should have been a css folder with a default css file to be easier to add styles to the web app

Or better add tailwind with the advance flag

I agree with the suggestion for Tailwind, as mentioned in #186,#224.

Because Go + HTMX is better, and the only missing component is CSS, unlike other languages, especially Java, which consumes a lot of memory.

Also I don't understand why most developers write Java when it's better to write Go, especially for microservices.

@kobamkode kobamkode deleted the assets branch April 12, 2024 06:48
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