Serve CSS dependencies from local webserver
Privacy improvement.
This commit is contained in:
parent
eab91b7272
commit
5d58ba89c4
2
.gitignore
vendored
2
.gitignore
vendored
@ -4,3 +4,5 @@ __pycache__/
|
|||||||
*.*swp*
|
*.*swp*
|
||||||
docker-compose.yml
|
docker-compose.yml
|
||||||
dist/
|
dist/
|
||||||
|
node_modules/
|
||||||
|
yarn*.log
|
||||||
|
12
Dockerfile
12
Dockerfile
@ -2,17 +2,19 @@ FROM python:3.8-alpine
|
|||||||
|
|
||||||
RUN adduser -S fabcal
|
RUN adduser -S fabcal
|
||||||
|
|
||||||
RUN apk add --no-cache build-base libuv-dev libffi-dev && \
|
RUN apk add --no-cache build-base libuv-dev libffi-dev yarn && \
|
||||||
pip3 install poetry
|
pip3 install -U poetry
|
||||||
|
|
||||||
|
RUN install -d -o fabcal /app
|
||||||
|
|
||||||
USER fabcal
|
USER fabcal
|
||||||
|
|
||||||
COPY poetry.lock pyproject.toml /app/
|
COPY poetry.lock pyproject.toml package.json yarn.lock /app/
|
||||||
|
|
||||||
WORKDIR /app/
|
WORKDIR /app/
|
||||||
|
|
||||||
RUN pip install -U poetry && \
|
RUN poetry install --only main && \
|
||||||
poetry install --only main
|
yarn install
|
||||||
|
|
||||||
COPY fabcal /app/fabcal/
|
COPY fabcal /app/fabcal/
|
||||||
COPY static/ /app/static/
|
COPY static/ /app/static/
|
||||||
|
@ -13,6 +13,9 @@ app = FastAPI()
|
|||||||
|
|
||||||
app.mount("/static", StaticFiles(directory="static"), name="static")
|
app.mount("/static", StaticFiles(directory="static"), name="static")
|
||||||
|
|
||||||
|
for framework in ["normalize.css", "milligram", "@fortawesome/fontawesome-free"]:
|
||||||
|
app.mount(f"/assets/{framework}", StaticFiles(directory=f"node_modules/{framework}"), name=framework)
|
||||||
|
|
||||||
app.include_router(api_v1.router, prefix="/api/v1")
|
app.include_router(api_v1.router, prefix="/api/v1")
|
||||||
app.include_router(frontend.router, prefix="")
|
app.include_router(frontend.router, prefix="")
|
||||||
|
|
||||||
|
10
package.json
Normal file
10
package.json
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"name": "fabcal",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"author": "Fabian Müller <fabian@fablab-altmuehlfranken.de>",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@fortawesome/fontawesome-free": "^6.2.1",
|
||||||
|
"milligram": "^1.4.1"
|
||||||
|
}
|
||||||
|
}
|
@ -2,10 +2,9 @@
|
|||||||
<html lang="de">
|
<html lang="de">
|
||||||
<head>
|
<head>
|
||||||
{% block header %}
|
{% block header %}
|
||||||
{#- TODO: replace with locally served files #}
|
<link rel="stylesheet" href="{{ url_for('normalize.css', path='normalize.css') }}">
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.css">
|
<link rel="stylesheet" href="{{ url_for('milligram', path='dist/milligram.min.css') }}">
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/milligram/1.4.1/milligram.css">
|
<link rel="stylesheet" href="{{ url_for('@fortawesome/fontawesome-free', path='css/all.min.css') }}">
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css">
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="{{ url_for('static', path='style.css') }}" type="text/css"/>
|
<link rel="stylesheet" href="{{ url_for('static', path='style.css') }}" type="text/css"/>
|
||||||
<link rel="stylesheet" href="{{ url_for('static', path='roboto.css') }}" type="text/css"/>
|
<link rel="stylesheet" href="{{ url_for('static', path='roboto.css') }}" type="text/css"/>
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="de">
|
<html lang="de">
|
||||||
<head>
|
<head>
|
||||||
{#- TODO: replace with locally served files #}
|
<link rel="stylesheet" href="{{ url_for('normalize.css', path='normalize.css') }}">
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.css">
|
<link rel="stylesheet" href="{{ url_for('milligram', path='dist/milligram.min.css') }}">
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/milligram/1.4.1/milligram.css">
|
<link rel="stylesheet" href="{{ url_for('@fortawesome/fontawesome-free', path='css/all.min.css') }}">
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css">
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="{{ url_for('static', path='style.css') }}" type="text/css"/>
|
<link rel="stylesheet" href="{{ url_for('static', path='style.css') }}" type="text/css"/>
|
||||||
<link rel="stylesheet" href="{{ url_for('static', path='roboto.css') }}" type="text/css"/>
|
<link rel="stylesheet" href="{{ url_for('static', path='roboto.css') }}" type="text/css"/>
|
||||||
|
20
yarn.lock
Normal file
20
yarn.lock
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||||
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
|
"@fortawesome/fontawesome-free@^6.2.1":
|
||||||
|
version "6.2.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free/-/fontawesome-free-6.2.1.tgz#344baf6ff9eaad7a73cff067d8c56bfc11ae5304"
|
||||||
|
integrity sha512-viouXhegu/TjkvYQoiRZK3aax69dGXxgEjpvZW81wIJdxm5Fnvp3VVIP4VHKqX4SvFw6qpmkILkD4RJWAdrt7A==
|
||||||
|
|
||||||
|
milligram@^1.4.1:
|
||||||
|
version "1.4.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/milligram/-/milligram-1.4.1.tgz#6c8c781541b0d994ccca784c60f0aca1f7104b42"
|
||||||
|
integrity sha512-RCgh/boHhcXWOUfKJWm3RJRoUeaEguoipDg0mJ31G0tFfvcpWMUlO1Zlqqr12K4kAXfDlllaidu0x7PaL2PTFg==
|
||||||
|
dependencies:
|
||||||
|
normalize.css "~8.0.1"
|
||||||
|
|
||||||
|
normalize.css@~8.0.1:
|
||||||
|
version "8.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/normalize.css/-/normalize.css-8.0.1.tgz#9b98a208738b9cc2634caacbc42d131c97487bf3"
|
||||||
|
integrity sha512-qizSNPO93t1YUuUhP22btGOo3chcvDFqFaj2TRybP0DMxkHOCTYwp3n34fel4a31ORXy4m1Xq0Gyqpb5m33qIg==
|
Loading…
Reference in New Issue
Block a user