summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgumi <git@gumi.ca>2019-08-12 18:25:40 -0400
committergumi <git@gumi.ca>2019-08-12 19:00:55 -0400
commitec8c010c546274f18eaa71c69c9a3092a163cda3 (patch)
treeedf775d997ba018cc9ba86e16dc3311e11771bd8
parente78f60a9b8cb995be7d76e337ead427c8a541bee (diff)
downloadwebsite-ec8c010c546274f18eaa71c69c9a3092a163cda3.tar.gz
website-ec8c010c546274f18eaa71c69c9a3092a163cda3.tar.bz2
website-ec8c010c546274f18eaa71c69c9a3092a163cda3.tar.xz
website-ec8c010c546274f18eaa71c69c9a3092a163cda3.zip
only use the compression plugins in production mode
-rw-r--r--src/components/News.vue21
-rw-r--r--vue.config.js4
2 files changed, 16 insertions, 9 deletions
diff --git a/src/components/News.vue b/src/components/News.vue
index e3f9bde..7ad844f 100644
--- a/src/components/News.vue
+++ b/src/components/News.vue
@@ -53,14 +53,11 @@
}
& .body {
- margin-top: 1ex;
+ margin-top: 2ex;
- & > br {
- margin-bottom: 1em;
- }
-
- & b {
+ &::v-deep > b {
display: block;
+ margin-bottom: 1ex;
}
& :any-link {
@@ -80,7 +77,7 @@
& q {
color: #009000;
- margin-top: 0.5em;
+ margin-top: 2ex;
display: inline-block;
&::before {
@@ -115,9 +112,17 @@ export default class News extends Vue {
@Prop({ default: 0 }) private from!: number;
private entries: NewsEntry[] = (newsEntries as NewsEntry[]).slice(this.from, this.count);
+ beautify () {
+ this.entries.forEach(entry => {
+ // FIXME: weird Vue bug
+ entry.html = entry.html.replace(/<br\/>/g,"<br></br>");
+ });
+ }
+
mounted () {
if (!process.env.VUE_APP_NEWS_JSON || !process.env.VUE_APP_NEWS_JSON.startsWith("https")) {
// TODO: allow arbitrary paths (no hardcoded news.json)
+ this.beautify();
return;
}
@@ -127,6 +132,7 @@ export default class News extends Vue {
if (newsCache !== null) {
this.entries = (JSON.parse(newsCache) as NewsEntry[]).slice(this.from, this.count);
+ this.beautify();
}
}
@@ -139,6 +145,7 @@ export default class News extends Vue {
.then(data => data.json())
.then(data => {
this.entries = (data as NewsEntry[]).slice(this.from, this.count);
+ this.beautify();
if (Reflect.has(self, "localStorage")) {
localStorage.setItem("newsCache", JSON.stringify(data));
diff --git a/vue.config.js b/vue.config.js
index be8982d..c481b94 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -6,7 +6,7 @@ module.exports = {
//integrity: true, // enable SRI in script/style tags
parallel: true,
configureWebpack: {
- plugins: [
+ plugins: process.env.NODE_ENV === "production" ? [
new CompressionPlugin({
filename: "[path].br[query]",
algorithm: "brotliCompress",
@@ -34,6 +34,6 @@ module.exports = {
return zopfli.gzip(input, compressionOptions, callback);
},
}),
- ],
+ ]: [],
}
}