refactor: static path

This commit is contained in:
Matthieu Bessat 2020-08-30 14:51:05 +02:00
parent c5f08ddbd9
commit 031f78ce27
8 changed files with 20 additions and 20 deletions

View file

@ -53,10 +53,10 @@
"test": "jest --verbose --detectOpenHandles", "test": "jest --verbose --detectOpenHandles",
"test-watch": "jest --verbose --watchAll", "test-watch": "jest --verbose --watchAll",
"dev": "./node_modules/.bin/tsc --watch", "dev": "./node_modules/.bin/tsc --watch",
"serve": "env ASSETS_PATH=./assets/development ./node_modules/.bin/nodemon dist/app.js", "serve": "env NODE_ENV=development ./node_modules/.bin/nodemon dist/app.js",
"build": "./node_modules/.bin/tsc", "build": "./node_modules/.bin/tsc",
"assets": "./node_modules/.bin/gulp build", "assets": "./node_modules/.bin/gulp build",
"start": "env ASSETS_PATH=./assets/production node ./dist/app.js" "start": "env NODE_ENV=production node ./dist/app.js"
}, },
"main": "dist/index.js", "main": "dist/index.js",
"devDependencies": { "devDependencies": {

View file

@ -125,9 +125,9 @@ let main = async () => {
//app.post('/api/media', MediaController.uploadRoute()) //app.post('/api/media', MediaController.uploadRoute())
//app.delete('/api/media/:key', MediaController.delete) //app.delete('/api/media/:key', MediaController.delete)
const assetsPath: string = process.env.ASSETS_PATH === undefined ? './assets/development' : process.env.ASSETS_PATH //const assetsPath: string = process.env.ASSETS_PATH === undefined ? './assets/development' : process.env.ASSETS_PATH
app.use(express.static(path.resolve(assetsPath))) app.use('/static', express.static(path.resolve('./assets/development')))
app.get('/500', ErrorController.internalError) app.get('/500', ErrorController.internalError)

View file

@ -8,14 +8,14 @@ Github: https://github.com/lefuturiste
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width"> <meta name="viewport" content="width=device-width">
<link rel="icon" type="image/png" href="/imgs/favicon.png" /> <link rel="icon" type="image/png" href="/static/imgs/favicon.png" />
<title>{% block title %}{% endblock %} | Forum des associations 2020</title> <title>{% block title %}{% endblock %} | Forum des associations 2020</title>
<link href="https://fonts.googleapis.com/css2?family=Roboto&family=Roboto+Slab&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Roboto&family=Roboto+Slab&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/styles/main.css" /> <link rel="stylesheet" href="/static/styles/main.css" />
{% if layout is not defined %} {% if layout is not defined %}
<link rel="stylesheet" href="/styles/home.css" /> <link rel="stylesheet" href="/static/styles/home.css" />
{% endif %} {% endif %}
{% block head %}{% endblock %} {% block head %}{% endblock %}
@ -29,7 +29,7 @@ Github: https://github.com/lefuturiste
<div class="container header-container"> <div class="container header-container">
<div class="header-left"> <div class="header-left">
<div class="header-image"> <div class="header-image">
<a href="/"><img src="/imgs/espace_condorcet_logo.jpg" /></a> <a href="/"><img src="/static/imgs/espace_condorcet_logo.jpg" /></a>
</div> </div>
<div class="header-content"> <div class="header-content">
<a <a
@ -72,6 +72,6 @@ Github: https://github.com/lefuturiste
</div> </div>
{% block scripts %}{% endblock %} {% block scripts %}{% endblock %}
<script src="/scripts/main.js"></script> <script src="/static/scripts/main.js"></script>
</body> </body>
</html> </html>

View file

@ -2,7 +2,7 @@
{% block title %}Accueil{% endblock %} {% block title %}Accueil{% endblock %}
{% block head %} {% block head %}
{% include './home-metas.twig' %} {% include './home-metas.twig' %}
<link rel="stylesheet" href="/styles/countdown.css" /> <link rel="stylesheet" href="/static/styles/countdown.css" />
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div class="countdown" id="countdown"> <div class="countdown" id="countdown">
@ -37,5 +37,5 @@
<script> <script>
let openDate = new Date(`{{ openDate }}`) let openDate = new Date(`{{ openDate }}`)
</script> </script>
<script src="/scripts/countdown.js"></script> <script src="/static/scripts/countdown.js"></script>
{% endblock %} {% endblock %}

View file

@ -1,7 +1,7 @@
{% extends "./base.twig" %} {% extends "./base.twig" %}
{% block title %}{{ title }}{% endblock %} {% block title %}{{ title }}{% endblock %}
{% block head %} {% block head %}
<link rel="stylesheet" href="/styles/error.css" /> <link rel="stylesheet" href="/static/styles/error.css" />
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div class="error-container"> <div class="error-container">

View file

@ -1,7 +1,7 @@
{% set metaDescription = "Découvrez la riche vie associative autour de Gaillon-Aubevoye grâce au forum virtuel mis en place par l'Espace Condorcet" %} {% set metaDescription = "Découvrez la riche vie associative autour de Gaillon-Aubevoye grâce au forum virtuel mis en place par l'Espace Condorcet" %}
<meta name="msapplication-TileColor" content="#D35400"> <meta name="msapplication-TileColor" content="#D35400">
<meta name="msapplication-TileImage" content="/imgs/espace_condorcet_logo.jpg"> <meta name="msapplication-TileImage" content="/static/imgs/espace_condorcet_logo.jpg">
<meta name="theme-color" content="#D35400"> <meta name="theme-color" content="#D35400">
@ -13,11 +13,11 @@
<meta property="og:title" content="Forum virtuel des associations 2020"> <meta property="og:title" content="Forum virtuel des associations 2020">
<meta property="og:description" content="{{ metaDescription }}"> <meta property="og:description" content="{{ metaDescription }}">
<meta property="og:type" content="website"> <meta property="og:type" content="website">
<meta property="og:image" content="/imgs/espace_condorcet_logo.jpg"> <meta property="og:image" content="/static/imgs/espace_condorcet_logo.jpg">
<meta property="og:url" content="https://associations.espacecondorcet.org/"> <meta property="og:url" content="https://associations.espacecondorcet.org/">
<meta name="twitter:card" content="summary"> <meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Forum virtuel des associations 2020"> <meta name="twitter:title" content="Forum virtuel des associations 2020">
<meta name="twitter:url" content="https://associations.espacecondorcet.org/"> <meta name="twitter:url" content="https://associations.espacecondorcet.org/">
<meta name="twitter:image:src" content="/imgs/espace_condorcet_logo.jpg"> <meta name="twitter:image:src" content="/static/imgs/espace_condorcet_logo.jpg">
<meta name="twitter:description" content="{{ metaDescription }}"> <meta name="twitter:description" content="{{ metaDescription }}">

View file

@ -2,7 +2,7 @@
{% block title %}Accueil{% endblock %} {% block title %}Accueil{% endblock %}
{% block head %} {% block head %}
{% include './home-metas.twig' %} {% include './home-metas.twig' %}
<link rel="stylesheet" href="/styles/home.css" /> <link rel="stylesheet" href="/static/styles/home.css" />
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div class="nav"> <div class="nav">
@ -84,5 +84,5 @@
let isProposed = {{ isProposed }} let isProposed = {{ isProposed }}
let organizations = JSON.parse(`{{ organizationsJSON|escape('js') }}`) let organizations = JSON.parse(`{{ organizationsJSON|escape('js') }}`)
</script> </script>
<script src="/scripts/home.js"></script> <script src="/static/scripts/home.js"></script>
{% endblock %} {% endblock %}

View file

@ -1,7 +1,7 @@
{% extends "./base.twig" %} {% extends "./base.twig" %}
{% block title %}{{ data.name }}{% endblock %} {% block title %}{{ data.name }}{% endblock %}
{% block head %} {% block head %}
<link rel="stylesheet" href="/styles/organization.css" /> <link rel="stylesheet" href="/static/styles/organization.css" />
<meta name="description" content="{{ data.descriptionShort|e }}"> <meta name="description" content="{{ data.descriptionShort|e }}">
{#<meta name="keywords" content="Gaillon,association,">#} {#<meta name="keywords" content="Gaillon,association,">#}
@ -456,5 +456,5 @@
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script src="/scripts/organization.js"></script> <script src="/static/scripts/organization.js"></script>
{% endblock %} {% endblock %}