-
-
Notifications
You must be signed in to change notification settings - Fork 155
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
Installed tailwind, added components page, created toy components with django-components and embedded Vue #4800
Open
ashkonf
wants to merge
3
commits into
main
Choose a base branch
from
add-tailwind-and-components-page
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@import "tailwindcss"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{% load static %}{% load humanize %}{% load widget_tweaks %}{% load extras %}{% load waffle_tags %} | ||
{% load static tailwind_tags %}{% load humanize %}{% load widget_tweaks %}{% load extras %}{% load waffle_tags %} | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
|
@@ -54,6 +54,10 @@ | |
|
||
<link href="{% static "css/font-awesome.css" %}" rel="stylesheet"> | ||
|
||
<link href="{% static "css/app.css" %}" rel="stylesheet"> | ||
{% tailwind_css %} | ||
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script> | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We never rely on a CDN this way. We have our own and it's more secure not to trust others. I think it'd probably also fail our CSP rules (but not sure). |
||
{% block privacy %} | ||
{% if private %} | ||
<meta name="robots" content="noindex, noodp, noarchive, noimageindex" /> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from django_components.component import Component, register | ||
|
||
|
||
@register("date") | ||
class Date(Component): | ||
template = "<div class='date-component rounded-lg border border-gray-200 flex items-center px-4 py-2'>Today's date is {{ date }}</div>" | ||
|
||
def get_context_data(self, date): | ||
return {"date": date} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm finding this a bit weird. We link to app.css, which imports tailwindcss. Gotta be a better way. I think Bots.law just has:
Honestly not sure what the preload vs. regular do, but definitely simpler/cleaner?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the documentation, the {% tailwind_css %} tag generates a stylesheet link for the app that has all the tailwind assets. This is the only step required to include Tailwind CSS on a page. The preload tag generates a preload directive for the stylesheet, which improves loading performance in production.