Skip to content

Commit

Permalink
feat(tailwind): move tailwind config to bfportal folder (#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
MagneticNeedle authored Jul 11, 2023
2 parents 7c4b96f + f316f06 commit dc2372c
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 23 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}

COPY --chown=wagtail:wagtail --from=node_base /usr/local/bin /usr/local/bin
COPY --chown=wagtail:wagtail --from=node_base /usr/local/lib/node_modules/npm /usr/local/lib/node_modules/npm
COPY ./bfportal ./
RUN chown -R wagtail:wagtail /app
COPY --chown=wagtail:wagtail ["package.json", "package-lock.json", "tailwind.config.js", "./"]
USER wagtail
RUN npm install


# Copy the source code of the project into the container.
COPY --chown=wagtail:wagtail ./bfportal ./

FROM dev as final
USER wagtail

RUN npx tailwindcss -i ./bfportal/static/src/styles.css -o ./bfportal/static/css/bfportal.css --minify
RUN python manage.py collectstatic --noinput --clear -i static/src/*
32 changes: 21 additions & 11 deletions bfportal/bfportal/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@
<meta name="viewport" content="width=device-width, initial-scale=1"/>
{% block preload_media %}{% endblock %}
<link rel="stylesheet" href="{% static "css/bfportal.css" %}">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.13.2/themes/base/jquery-ui.min.css" integrity="sha512-ELV+xyi8IhEApPS/pSj66+Jiw+sOT1Mqkzlh8ExXihe4zfqbWkxPRi8wptXIO9g73FSlhmquFlUOuMSoXz5IRw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.13.2/themes/base/theme.min.css" integrity="sha512-hbs/7O+vqWZS49DulqH1n2lVtu63t3c3MTAn0oYMINS5aT8eIAbJGDXgLt6IxDHcWyzVTgf9XyzZ9iWyVQ7mCQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.13.2/themes/base/jquery-ui.min.css"
integrity="sha512-ELV+xyi8IhEApPS/pSj66+Jiw+sOT1Mqkzlh8ExXihe4zfqbWkxPRi8wptXIO9g73FSlhmquFlUOuMSoXz5IRw=="
crossorigin="anonymous" referrerpolicy="no-referrer"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.13.2/themes/base/theme.min.css"
integrity="sha512-hbs/7O+vqWZS49DulqH1n2lVtu63t3c3MTAn0oYMINS5aT8eIAbJGDXgLt6IxDHcWyzVTgf9XyzZ9iWyVQ7mCQ=="
crossorigin="anonymous" referrerpolicy="no-referrer"/>
{% block extra_css %}
{# Override this in templates to add extra stylesheets #}
{% endblock %}
Expand Down Expand Up @@ -96,7 +100,6 @@
}
</script>
</head>
</head>
<body class="bg-bg-default min-h-screen m-0 relative flex flex-col {% block body_class %}{% endblock %}">
<div id="popUpBackground" class="fixed w-screen h-screen bg-default/[.95] z-[1] hidden" onclick="hidePopUps()"></div>
{% block header %}
Expand Down Expand Up @@ -130,7 +133,9 @@
<script src="{% static 'js/jquery.min.js' %}"
integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.13.2/jquery-ui.min.js" integrity="sha512-57oZ/vW8ANMjR/KQ6Be9v/+/h6bq9/l3f0Oc7vn6qMqyhvPd1cvKBRWWpzu0QoneImqr2SkmO4MSqU+RpHom3Q==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.13.2/jquery-ui.min.js"
integrity="sha512-57oZ/vW8ANMjR/KQ6Be9v/+/h6bq9/l3f0Oc7vn6qMqyhvPd1cvKBRWWpzu0QoneImqr2SkmO4MSqU+RpHom3Q=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js"
integrity="sha512-z4OUqw38qNLpn1libAN9BsoDx6nbNFio5lA6CuTp9NlK83b89hgyCVq+N5FdBJptINztxn1Z3SaKSKUS5UP60Q=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
Expand Down Expand Up @@ -222,7 +227,7 @@
document.getElementById('discord-nav').appendChild(span)

if (document.location.pathname === '/') {
const duration = 5,
const duration = 5,
countStep = Math.trunc((totalCount / duration) / 50);

let currCount = 0
Expand All @@ -234,6 +239,7 @@
setTimeout(increaseCount, duration)
}
}

increaseCount()
} else {
span.innerHTML = `&nbsp;&nbsp;${totalCount} members online`
Expand All @@ -243,18 +249,19 @@
})
}
)

async function copyDivToClipboard(elem) {
const container_div = $(elem);
if (container_div.attr('data-copy-state') === "normal"){ // only run when the inner html is set correctly
if (container_div.attr('data-copy-state') === "normal") { // only run when the inner html is set correctly
const old_html = container_div.html(),
state_class = "bg-bf2042-5 hover:bg-bf2042-5";

container_div.attr('data-copy-state', "copy");
await navigator.clipboard.writeText(container_div.attr('data-copy')).then(
() =>{
() => {
container_div.addClass(state_class);
container_div.text("Copied")
setTimeout(function () {
setTimeout(function () {
container_div.fadeOut(200, function () {
container_div.html(old_html).fadeIn(1000);
container_div.attr('data-copy-state', "normal")
Expand All @@ -268,14 +275,17 @@
)
}
}
document.addEventListener('keydown', function(e) {
if(e.key === "Escape"){
hidePopUps();

document.addEventListener('keydown', function (e) {
if (e.key === "Escape") {
hidePopUps();
}
});

function hidePopUps() {
$('#popUpBackground, .popup').fadeOut(100)
}

function showPopUp(id) {
const popup = $(document.getElementById(id))
if (popup) {
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json → bfportal/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json → bfportal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"@tailwindcss/typography": "^0.5.9"
},
"scripts": {
"watch": "npx tailwindcss -i bfportal/bfportal/static/src/styles.css -o bfportal/bfportal/static/css/bfportal.css --watch",
"build": "npx tailwindcss -i bfportal/bfportal/static/src/styles.css -o bfportal/bfportal/static/css/bfportal.css --minify"
"watch": "npx tailwindcss -i ./bfportal/static/src/styles.css -o ./bfportal/static/css/bfportal.css --watch",
"build": "npx tailwindcss -i ./bfportal/static/src/styles.css -o ./bfportal/static/css/bfportal.css --minify"
}
}
5 changes: 3 additions & 2 deletions tailwind.config.js → bfportal/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ module.exports = {
/**
* HTML. Paths to Django template files that will contain Tailwind CSS classes.
*/
'bfportal/**/templates/**/*.html',
'bfportal/**/static/js/*.js',
'./**/templates/**/*.html',
'./**/templates/**/**/*.html',
'./**/static/js/*.js',
],
theme: {
extend: {
Expand Down
6 changes: 2 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,20 +179,18 @@ services:
context: .
dockerfile: Dockerfile
target: dev
command: npx tailwindcss -i ./bfportal/static/src/styles.css -o ./bfportal/static/css/bfportal.css --watch
command: npm run watch
restart: always
container_name: bfportal_dev_local_tailwind
profiles:
- dev_local
volumes:
- ./bfportal/bfportal:/app/bfportal
- ./bfportal/core:/app/core
- ./bfportal:/app
depends_on:
bfportal_dev_local:
condition: service_healthy
stdin_open: true


volumes:
postgress_db_devel:
postgress_db:
Expand Down

0 comments on commit dc2372c

Please sign in to comment.