diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 0c7de621..cf291fbe 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -90,7 +90,7 @@ jobs: working-directory: Themerr-plex.bundle run: | npm install - mv ./node_modules ./Contents/Resources/web + npm run build - name: Build plist shell: bash diff --git a/Contents/Resources/web/templates/base.html b/Contents/Resources/web/templates/base.html index 7a0a6ad2..031fa092 100644 --- a/Contents/Resources/web/templates/base.html +++ b/Contents/Resources/web/templates/base.html @@ -12,20 +12,20 @@ - + - - + + - + - + diff --git a/Dockerfile b/Dockerfile index 721d9787..a8f26ddc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -66,7 +66,7 @@ RUN <<_NPM #!/bin/bash set -e npm install -mv ./node_modules ./Contents/Resources/web +npm run build _NPM # clean diff --git a/docs/source/contributing/build.rst b/docs/source/contributing/build.rst index af124567..fcba4a95 100644 --- a/docs/source/contributing/build.rst +++ b/docs/source/contributing/build.rst @@ -2,7 +2,7 @@ Build ===== -Compiling Themerr-plex is fairly simple; however it is recommended to use Python 2.7 since the Plex framework is using +Compiling Themerr-plex is fairly simple; however you need to use Python 2.7 since the Plex framework is using Python 2.7. Clone @@ -53,17 +53,7 @@ Install npm dependencies. .. code-block:: bash npm install - -Move modules directory. - Linux/macOS - .. code-block:: bash - - mv ./node_modules ./Contents/Resources/web - - Windows - .. code-block:: batch - - move .\node_modules .\Contents\Resources\web + npm run build Remote Build ------------ diff --git a/package.json b/package.json index 88c4d4da..c47f7ef7 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,17 @@ { + "scripts": { + "build": "webpack" + }, "dependencies": { "@fontsource/open-sans": "5.0.20", "@fortawesome/fontawesome-free": "6.5.1", "bootstrap": "5.3.2", "jquery": "3.7.1" + }, + "devDependencies": { + "css-loader": "6.10.0", + "mini-css-extract-plugin": "2.8.1", + "webpack": "5.90.3", + "webpack-cli": "5.1.4" } } diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 00000000..579d9fa2 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,32 @@ +const path = require('path'); +const MiniCssExtractPlugin = require('mini-css-extract-plugin'); + +module.exports = { + entry: { + bootstrap: [ + 'bootstrap/dist/js/bootstrap.bundle.min.js', + 'bootstrap/dist/css/bootstrap.min.css' + ], + fontawesome: '@fortawesome/fontawesome-free/css/all.min.css', + jquery: 'jquery/dist/jquery.min.js', + 'open-sans': '@fontsource/open-sans/index.css', + }, + output: { + filename: 'js/[name].bundle.js', + path: path.resolve(__dirname, 'Contents', 'Resources', 'web', 'dist'), + }, + mode: 'production', + module: { + rules: [ + { + test: /\.css$/, + use: [MiniCssExtractPlugin.loader, 'css-loader'], + }, + ], + }, + plugins: [ + new MiniCssExtractPlugin({ + filename: 'css/[name].bundle.css', + }), + ], +};