Compare commits
3 Commits
63962b7818
...
4cae6cc479
Author | SHA1 | Date | |
---|---|---|---|
4cae6cc479 | |||
b7c75b2e7e | |||
1d96024a6f |
Binary file not shown.
Before Width: | Height: | Size: 622 B |
Binary file not shown.
Before Width: | Height: | Size: 850 B |
@ -1,46 +0,0 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
||||
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
|
||||
width="16.000000pt" height="16.000000pt" viewBox="0 0 16.000000 16.000000"
|
||||
preserveAspectRatio="xMidYMid meet">
|
||||
<metadata>
|
||||
Created by potrace 1.11, written by Peter Selinger 2001-2013
|
||||
</metadata>
|
||||
<g transform="translate(0.000000,16.000000) scale(0.002286,-0.002286)"
|
||||
fill="#000000" stroke="none">
|
||||
<path d="M3220 6574 c-154 -16 -224 -25 -230 -29 -3 -2 -26 -6 -50 -10 -130
|
||||
-18 -361 -83 -545 -152 -418 -159 -812 -431 -1075 -743 -30 -36 -60 -69 -66
|
||||
-75 -18 -17 -111 -150 -156 -222 -42 -69 -138 -248 -138 -257 0 -3 35 -22 78
|
||||
-43 42 -20 102 -55 132 -77 162 -118 604 -587 765 -810 11 -16 36 -49 56 -75
|
||||
124 -161 287 -425 391 -634 28 -56 54 -104 58 -107 6 -4 2072 -5 2116 -1 6 1
|
||||
21 25 35 54 39 84 161 304 227 408 218 344 467 647 809 982 156 153 220 203
|
||||
330 258 94 46 92 34 26 159 -217 413 -559 756 -1009 1011 -57 32 -106 59 -109
|
||||
59 -2 0 -33 14 -67 31 -181 89 -548 207 -723 233 -22 4 -65 11 -95 16 -30 5
|
||||
-77 11 -105 14 -27 3 -77 8 -110 12 -98 11 -432 10 -545 -2z"/>
|
||||
<path d="M578 4828 c-182 -24 -427 -197 -515 -363 -45 -87 -62 -162 -59 -264
|
||||
6 -159 63 -291 211 -491 109 -146 231 -350 317 -529 l59 -125 41 47 c93 109
|
||||
276 207 418 224 30 4 281 7 557 8 l502 0 -27 50 c-137 263 -367 594 -587 845
|
||||
-113 129 -355 376 -454 463 -121 107 -296 158 -463 135z"/>
|
||||
<path d="M6270 4832 c-43 -6 -133 -33 -180 -54 -78 -35 -124 -73 -287 -236
|
||||
-212 -210 -283 -288 -438 -482 -139 -175 -273 -366 -338 -483 -14 -25 -37 -63
|
||||
-51 -86 -14 -22 -26 -43 -26 -45 0 -3 -13 -28 -30 -56 -16 -27 -26 -50 -22
|
||||
-51 4 0 243 -2 532 -4 504 -2 528 -3 598 -24 132 -39 263 -118 340 -207 l41
|
||||
-48 60 125 c108 223 174 334 317 530 153 210 216 369 209 528 -6 144 -49 242
|
||||
-154 354 -65 68 -196 162 -261 187 -19 7 -39 17 -45 21 -27 19 -202 40 -265
|
||||
31z"/>
|
||||
<path d="M1135 3039 c-13 -4 -26 -5 -28 -2 -7 7 -98 -22 -147 -47 -109 -56
|
||||
-195 -177 -217 -305 -7 -45 -7 -1013 1 -1067 23 -164 130 -288 296 -344 53
|
||||
-17 155 -18 2460 -18 1970 0 2412 2 2445 13 180 60 288 180 311 349 8 55 9
|
||||
1035 1 1072 -14 70 -61 166 -104 215 -55 62 -168 121 -253 131 -70 9 -4732 11
|
||||
-4765 3z"/>
|
||||
<path d="M1222 962 c-18 -2 -31 -6 -28 -10 2 -4 7 -34 10 -67 10 -108 56 -458
|
||||
61 -465 6 -9 344 -10 350 -1 2 4 7 32 10 62 3 30 8 65 10 79 2 14 7 48 10 75
|
||||
5 50 10 91 20 163 3 20 7 59 10 85 3 27 7 53 11 58 3 5 -2 12 -10 15 -16 6
|
||||
-399 11 -454 6z"/>
|
||||
<path d="M5367 962 c-32 -2 -56 -6 -53 -10 2 -4 7 -32 10 -62 7 -63 13 -110
|
||||
21 -160 2 -19 7 -57 10 -85 3 -27 7 -61 10 -75 2 -14 7 -52 10 -85 4 -32 9
|
||||
-63 11 -67 6 -9 343 -8 349 1 3 6 17 100 31 216 2 22 7 58 10 80 11 80 13 91
|
||||
19 150 3 33 8 68 11 78 4 14 -1 17 -28 18 -230 3 -363 3 -411 1z"/>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 2.7 KiB |
@ -5,10 +5,7 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="Description" content="Canapé">
|
||||
<link rel="icon" type="image/png" href="<%= require("./img/favicon-16x16.png").default %>" sizes="16x16">
|
||||
<link rel="icon" type="image/png" href="<%= require("./img/favicon-32x32.png").default %>" sizes="32x32">
|
||||
<meta name="msapplication-navbutton-color" content="#4E5D6C">
|
||||
<link rel="mask-icon" href="<%= require("./img/safari-pinned-tab.svg").default %>" color="#5bbad5">
|
||||
<meta name="msapplication-navbutton-color" content="#4e5d6c">
|
||||
<title>Canapé</title>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -1,12 +1,6 @@
|
||||
// Import default image
|
||||
import "../img/noimage.png";
|
||||
|
||||
// Import favicon settings
|
||||
import "../img/favicon-16x16.png";
|
||||
import "../img/favicon-32x32.png";
|
||||
import "../img/favicon.ico";
|
||||
import "../img/safari-pinned-tab.svg";
|
||||
|
||||
// Styles
|
||||
import "../scss/app.scss";
|
||||
|
||||
|
77
frontend/js/components/details/downloadProgress.js
Normal file
77
frontend/js/components/details/downloadProgress.js
Normal file
@ -0,0 +1,77 @@
|
||||
import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import { useSelector } from "react-redux";
|
||||
import { useHistory } from "react-router-dom";
|
||||
|
||||
export const DownloadProgress = ({ imdbId, season, episode }) => {
|
||||
let history = useHistory();
|
||||
const torrentGroup = useSelector((state) =>
|
||||
state.torrents.torrents.get(imdbId)
|
||||
);
|
||||
if (!torrentGroup || torrentGroup.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let torrent;
|
||||
const type = torrentGroup[0].type;
|
||||
switch (type) {
|
||||
case "movie":
|
||||
torrent = torrentGroup[0];
|
||||
break;
|
||||
case "episode": {
|
||||
if (!season || !episode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const torrents = torrentGroup.filter(
|
||||
(torrent) => torrent.episode === episode && torrent.season === season
|
||||
);
|
||||
if (torrents.length !== 1) {
|
||||
return null;
|
||||
}
|
||||
torrent = torrents[0];
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!torrent || !torrent.status) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const progress = Number(torrent.status.percent_done).toFixed(1);
|
||||
if (progress === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const handleClick = () => {
|
||||
history.push("/torrents/list");
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="w-100 mt-n2 clickable" onClick={handleClick}>
|
||||
<small className="text text-muted">Downloading...</small>
|
||||
<div
|
||||
className="progress"
|
||||
style={{
|
||||
height: "0.2rem",
|
||||
}}
|
||||
>
|
||||
<div
|
||||
className="progress-bar bg-warning"
|
||||
style={{
|
||||
width: `${progress}%`,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
DownloadProgress.propTypes = {
|
||||
imdbId: PropTypes.string.isRequired,
|
||||
season: PropTypes.number,
|
||||
episode: PropTypes.number,
|
||||
};
|
@ -12,6 +12,7 @@ import { Rating } from "../details/rating";
|
||||
import { ReleaseDate } from "../details/releaseDate";
|
||||
import { Runtime } from "../details/runtime";
|
||||
import { Title } from "../details/title";
|
||||
import { DownloadProgress } from "../details/downloadProgress";
|
||||
|
||||
const ListDetails = (props) => {
|
||||
if (!props.data || Object.keys(props.data).length === 0) {
|
||||
@ -41,6 +42,7 @@ const ListDetails = (props) => {
|
||||
subtitles={props.data.subtitles}
|
||||
/>
|
||||
</div>
|
||||
<DownloadProgress imdbId={props.data.imdb_id} />
|
||||
<TrackingLabel
|
||||
wishlisted={props.data.wishlisted}
|
||||
inLibrary={props.data.polochon_url !== ""}
|
||||
|
@ -20,6 +20,7 @@ import { PolochonMetadata } from "../details/polochon";
|
||||
import { TrackingLabel } from "../details/tracking";
|
||||
import { Genres } from "../details/genres";
|
||||
import { Runtime } from "../details/runtime";
|
||||
import { DownloadProgress } from "../details/downloadProgress";
|
||||
|
||||
import { DownloadAndStream } from "../buttons/download";
|
||||
import { ImdbBadge } from "../buttons/imdb";
|
||||
@ -122,6 +123,9 @@ export const Header = () => {
|
||||
subtitles={subtitles}
|
||||
/>
|
||||
</div>
|
||||
<div className="card-text mt-2">
|
||||
<DownloadProgress imdbId={imdbId} />
|
||||
</div>
|
||||
<p className="card-text">
|
||||
<TrackingLabel inLibrary={inLibrary} wishlisted={wishlisted} />
|
||||
</p>
|
||||
|
@ -11,6 +11,7 @@ import { PolochonMetadata } from "../../details/polochon";
|
||||
import { ReleaseDate } from "../../details/releaseDate";
|
||||
import { Runtime } from "../../details/runtime";
|
||||
import { Title } from "../../details/title";
|
||||
import { DownloadProgress } from "../../details/downloadProgress";
|
||||
|
||||
import { DownloadAndStream } from "../../buttons/download";
|
||||
import { ShowMore } from "../../buttons/showMore";
|
||||
@ -62,6 +63,7 @@ export const Episode = ({ season, episode }) => {
|
||||
/>
|
||||
<ReleaseDate date={data.aired} />
|
||||
<Runtime runtime={data.runtime} />
|
||||
<DownloadProgress imdbId={imdbId} season={season} episode={episode} />
|
||||
<Plot plot={data.plot} />
|
||||
<DownloadAndStream
|
||||
name={prettyEpisodeName(showTitle, season, episode)}
|
||||
|
170
frontend/package-lock.json
generated
170
frontend/package-lock.json
generated
@ -48,8 +48,10 @@
|
||||
"eslint-plugin-react": "^7.24.0",
|
||||
"eslint-plugin-react-hooks": "^4.2.0",
|
||||
"html-webpack-plugin": "^5.3.2",
|
||||
"mini-css-extract-plugin": "^2.2.0",
|
||||
"postcss-loader": "^6.1.1",
|
||||
"prettier": "^2.3.2",
|
||||
"purgecss-webpack-plugin": "^4.0.3",
|
||||
"sass": "^1.37.5",
|
||||
"sass-loader": "^12.1.0",
|
||||
"style-loader": "^3.2.1",
|
||||
@ -6108,6 +6110,43 @@
|
||||
"react": "^0.14.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/mini-css-extract-plugin": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-2.2.0.tgz",
|
||||
"integrity": "sha512-91HeVHbq7PUJ4TwOuMTlFWfVWrLqf3SF0PlEDPV+wtgsfxrMebN9LLzflyQqdKLp4/H3PexRB1WLKsCqpWKkxQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"schema-utils": "^3.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 12.13.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/webpack"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"webpack": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/mini-css-extract-plugin/node_modules/schema-utils": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz",
|
||||
"integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/json-schema": "^7.0.8",
|
||||
"ajv": "^6.12.5",
|
||||
"ajv-keywords": "^3.5.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10.13.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/webpack"
|
||||
}
|
||||
},
|
||||
"node_modules/minimatch": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||
@ -6909,6 +6948,66 @@
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/purgecss": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/purgecss/-/purgecss-4.0.3.tgz",
|
||||
"integrity": "sha512-PYOIn5ibRIP34PBU9zohUcCI09c7drPJJtTDAc0Q6QlRz2/CHQ8ywGLdE7ZhxU2VTqB7p5wkvj5Qcm05Rz3Jmw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"commander": "^6.0.0",
|
||||
"glob": "^7.0.0",
|
||||
"postcss": "^8.2.1",
|
||||
"postcss-selector-parser": "^6.0.2"
|
||||
},
|
||||
"bin": {
|
||||
"purgecss": "bin/purgecss.js"
|
||||
}
|
||||
},
|
||||
"node_modules/purgecss-webpack-plugin": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/purgecss-webpack-plugin/-/purgecss-webpack-plugin-4.0.3.tgz",
|
||||
"integrity": "sha512-YqmHRuKqjPhB+f/kURHYwlUR2QDcS8NSpCWrgQNICsSd8S2+tj40SDBav5b8KaSPQ8b/uXqrJxa/SnLyHK4BvQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"purgecss": "^4.0.3",
|
||||
"webpack": "^5.4.0",
|
||||
"webpack-sources": "^2.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"webpack": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/purgecss-webpack-plugin/node_modules/source-map": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/purgecss-webpack-plugin/node_modules/webpack-sources": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-2.3.1.tgz",
|
||||
"integrity": "sha512-y9EI9AO42JjEcrTJFOYmVywVZdKVUfOvDUPsJea5GIr1JOEGFVqwlY2K098fFoIjOkDzHn2AjRvM8dsBZu+gCA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"source-list-map": "^2.0.1",
|
||||
"source-map": "^0.6.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/purgecss/node_modules/commander": {
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz",
|
||||
"integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/randombytes": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
|
||||
@ -13665,6 +13764,28 @@
|
||||
"tiny-warning": "^1.0.3"
|
||||
}
|
||||
},
|
||||
"mini-css-extract-plugin": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-2.2.0.tgz",
|
||||
"integrity": "sha512-91HeVHbq7PUJ4TwOuMTlFWfVWrLqf3SF0PlEDPV+wtgsfxrMebN9LLzflyQqdKLp4/H3PexRB1WLKsCqpWKkxQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"schema-utils": "^3.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"schema-utils": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz",
|
||||
"integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/json-schema": "^7.0.8",
|
||||
"ajv": "^6.12.5",
|
||||
"ajv-keywords": "^3.5.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||
@ -14259,6 +14380,55 @@
|
||||
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
|
||||
"dev": true
|
||||
},
|
||||
"purgecss": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/purgecss/-/purgecss-4.0.3.tgz",
|
||||
"integrity": "sha512-PYOIn5ibRIP34PBU9zohUcCI09c7drPJJtTDAc0Q6QlRz2/CHQ8ywGLdE7ZhxU2VTqB7p5wkvj5Qcm05Rz3Jmw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"commander": "^6.0.0",
|
||||
"glob": "^7.0.0",
|
||||
"postcss": "^8.2.1",
|
||||
"postcss-selector-parser": "^6.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"commander": {
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz",
|
||||
"integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"purgecss-webpack-plugin": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/purgecss-webpack-plugin/-/purgecss-webpack-plugin-4.0.3.tgz",
|
||||
"integrity": "sha512-YqmHRuKqjPhB+f/kURHYwlUR2QDcS8NSpCWrgQNICsSd8S2+tj40SDBav5b8KaSPQ8b/uXqrJxa/SnLyHK4BvQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"purgecss": "^4.0.3",
|
||||
"webpack": "^5.4.0",
|
||||
"webpack-sources": "^2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"source-map": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||
"dev": true
|
||||
},
|
||||
"webpack-sources": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-2.3.1.tgz",
|
||||
"integrity": "sha512-y9EI9AO42JjEcrTJFOYmVywVZdKVUfOvDUPsJea5GIr1JOEGFVqwlY2K098fFoIjOkDzHn2AjRvM8dsBZu+gCA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"source-list-map": "^2.0.1",
|
||||
"source-map": "^0.6.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"randombytes": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
|
||||
|
@ -48,8 +48,10 @@
|
||||
"eslint-plugin-react": "^7.24.0",
|
||||
"eslint-plugin-react-hooks": "^4.2.0",
|
||||
"html-webpack-plugin": "^5.3.2",
|
||||
"mini-css-extract-plugin": "^2.2.0",
|
||||
"postcss-loader": "^6.1.1",
|
||||
"prettier": "^2.3.2",
|
||||
"purgecss-webpack-plugin": "^4.0.3",
|
||||
"sass": "^1.37.5",
|
||||
"sass-loader": "^12.1.0",
|
||||
"style-loader": "^3.2.1",
|
||||
|
@ -1,9 +1,12 @@
|
||||
var webpack = require("webpack");
|
||||
var path = require("path");
|
||||
const glob = require("glob");
|
||||
var WebpackPwaManifest = require("webpack-pwa-manifest");
|
||||
var HtmlWebpackPlugin = require("html-webpack-plugin");
|
||||
var { CleanWebpackPlugin } = require("clean-webpack-plugin");
|
||||
const WorkboxPlugin = require("workbox-webpack-plugin");
|
||||
const PurgeCSSPlugin = require("purgecss-webpack-plugin");
|
||||
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
||||
|
||||
var mode = "development";
|
||||
var BUILD_DIR = path.resolve(__dirname, "../build/public/");
|
||||
@ -21,7 +24,7 @@ const config = {
|
||||
output: {
|
||||
path: BUILD_DIR,
|
||||
filename: "[contenthash]-app.js",
|
||||
assetModuleFilename: "[hash]-[name][ext][query]",
|
||||
assetModuleFilename: "[contenthash]-[name][ext][query]",
|
||||
},
|
||||
optimization: {},
|
||||
module: {
|
||||
@ -36,9 +39,18 @@ const config = {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.css$/i,
|
||||
use: [MiniCssExtractPlugin.loader, "css-loader", "postcss-loader"],
|
||||
},
|
||||
{
|
||||
test: /\.scss$/,
|
||||
use: ["style-loader", "css-loader", "sass-loader", "postcss-loader"],
|
||||
use: [
|
||||
MiniCssExtractPlugin.loader,
|
||||
"css-loader",
|
||||
"sass-loader",
|
||||
"postcss-loader",
|
||||
],
|
||||
},
|
||||
{
|
||||
test: /\.(png|jpg|svg|ico)$/,
|
||||
@ -63,12 +75,13 @@ const config = {
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
template: path.join(SRC_DIR, "index.html"),
|
||||
favicon: path.join(SRC_DIR, "img/favicon.ico"),
|
||||
}),
|
||||
new WebpackPwaManifest({
|
||||
fingerprints: true,
|
||||
inject: true,
|
||||
ios: {
|
||||
"apple-mobile-web-app-status-bar-style": "default",
|
||||
"apple-mobile-web-app-status-bar-style": "#4e5d6c",
|
||||
"apple-mobile-web-app-title": "Canapé",
|
||||
},
|
||||
name: "Canapé",
|
||||
@ -97,6 +110,9 @@ const config = {
|
||||
},
|
||||
],
|
||||
}),
|
||||
new MiniCssExtractPlugin({
|
||||
filename: "[contenthash].css",
|
||||
}),
|
||||
new WorkboxPlugin.GenerateSW(),
|
||||
],
|
||||
resolve: {
|
||||
@ -105,4 +121,12 @@ const config = {
|
||||
devtool: mode === "production" ? false : "source-map",
|
||||
};
|
||||
|
||||
if (mode === "production") {
|
||||
config.plugins.push(
|
||||
new PurgeCSSPlugin({
|
||||
paths: () => glob.sync(`${SRC_DIR}/**/*`, { nodir: true }),
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = config;
|
||||
|
Loading…
x
Reference in New Issue
Block a user