add lang to css and js output filename to bust cache when changing localized images

box-drawing
Ondřej Hruška 7 years ago
parent 2e64f0e20b
commit e34ded0b8c
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 4
      _build_common.sh
  2. 2
      _build_css.sh
  3. 4
      pages/_head.php
  4. 3
      webpack.config.js

@ -1,3 +1,7 @@
#!/bin/bash
export FRONT_END_HASH=$(git rev-parse --short HEAD)
if [ -z "$ESP_LANG" ]; then
export ESP_LANG=en
fi

@ -10,4 +10,4 @@ else
fi
mkdir -p out/css
npm run sass -- --output-style ${stylearg} sass/app.scss "out/css/app.$FRONT_END_HASH.css"
npm run sass -- --output-style ${stylearg} sass/app.scss "out/css/app.$FRONT_END_HASH-$ESP_LANG.css"

@ -5,8 +5,8 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, maximum-scale=1">
<title><?= $_GET['PAGE_TITLE'] ?></title>
<link href="/css/app.<?= GIT_HASH ?>.css" rel="stylesheet">
<script src="/js/app.<?= GIT_HASH ?>.js"></script>
<link href="/css/app.<?= GIT_HASH . '-' . LOCALE ?>.css" rel="stylesheet">
<script src="/js/app.<?= GIT_HASH . '-' . LOCALE ?>.js"></script>
<script>
var _root = <?= JS_WEB_ROOT ?>;
var _demo = <?= (int)ESP_DEMO ?>;

@ -3,6 +3,7 @@ const { execSync } = require('child_process')
const path = require('path')
let hash = execSync('git rev-parse --short HEAD').toString().trim()
let lang = process.env.ESP_LANG || 'en'
let plugins = []
let devtool = 'source-map'
@ -23,7 +24,7 @@ module.exports = {
entry: './js',
output: {
path: path.resolve(__dirname, 'out', 'js'),
filename: `app.${hash}.js`
filename: `app.${hash}-${lang}.js`
},
module: {
rules: [

Loading…
Cancel
Save