概要
指定した Web サイトを nativefier を使ってアプリケーション化 (exe) する方法。
ブラウザで別ウインドウとして開く場合との違いは、アドレスバーなどの余計な表示がないこと。
視覚的にもスッキリし、画面も広く使えて実用的。
GMail や Slack、株価サイト等に適用すると便利。
環境
- Windows 10 Pro
-
nativefier
手順
インストール
node.js
nativefier のインストールには npm を使用する。
npm は node.js に含まれているので、まずは node.js の公式サイトからダウンロード・インストールする。
Node.js — Run JavaScript Everywhere
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
nativefier
コマンドラインから npm を使って nativefier をインストール。
> npm install nativefier -g
アプリケーション化
当サイトを ryoblog.exe という名前のアプリケーションにする例。
> nativefier --name "ryoblog" "https://raspi.ryo.sc/"
上記コマンドを実行したフォルダに ryoblog-win32-x64 というフォルダが作成され、その中に ryoblog.exe が作成される。
参考
オプション
Usage: cli [options] [dest] Options: -v, --version output the version number -n, --name app name -p, --platform 'osx', 'mas', 'linux' or 'windows' -a, --arch 'ia32' or 'x64' or 'armv7l' --app-version The release version of the application. Maps to the `ProductVersion` metadata property on Windows, and `CFBundleShortVersionString` on OS X. --build-version The build version of the application. Maps to the `FileVersion` metadata property on Windows, and `CFBundleVersion` on OS X. --app-copyright The human-readable copyright line for the app. Maps to the `LegalCopyright` metadata property on Windows, and `NSHumanReadableCopyright` on OS X --win32metadata a JSON string of key/value pairs of application metadata (ProductName, InternalName, FileDescription) to embed into the executable (Windows only). -e, --electron-version electron version to package, without the 'v', see https://github.com/electron/electron/releases --no-overwrite do not override output directory if it already exists, defaults to false -c, --conceal packages the source code within your app into an archive, defaults to false, see https://electronjs.org/docs/tutorial/application-packaging --counter if the target app should use a persistent counter badge in the dock (macOS only), defaults to false --bounce if the the dock icon should bounce when counter increases (macOS only), defaults to false -i, --icon the icon file to use as the icon for the app (should be a .png) --width set window default width, defaults to 1280px --height set window default height, defaults to 800px --min-width set window minimum width, defaults to 0px --min-height set window minimum height, defaults to 0px --max-width set window maximum width, default is no limit --max-height set window maximum height, default is no limit --x set window x location --y set window y location -m, --show-menu-bar set menu bar visible, defaults to false -f, --fast-quit quit app after window close (macOS only), defaults to false -u, --user-agent set the user agent string for the app --honest prevent the nativefied app from changing the user agent string to masquerade as a regular chrome browser --ignore-certificate ignore certificate related errors --disable-gpu disable hardware acceleration --ignore-gpu-blacklist allow WebGl apps to work on non supported graphics cards --enable-es3-apis force activation of WebGl 2.0 --insecure enable loading of insecure content, defaults to false --flash if flash should be enabled --flash-path path to Chrome flash plugin, find it in `Chrome://plugins` --disk-cache-size forces the maximum disk space (in bytes) to be used by the disk cache --inject path to a CSS/JS file to be injected (default: []) --full-screen if the app should always be started in full screen --maximize if the app should always be started maximized --hide-window-frame disable window frame and controls --verbose if verbose logs should be displayed --disable-context-menu disable the context menu --disable-dev-tools disable developer tools --zoom default zoom factor to use when the app is opened, defaults to 1.0 --internal-urls regular expression of URLs to consider "internal"; all other URLs will be opened in an external browser. (default: URLs on same second-level domain as app) --crash-reporter remote server URL to send crash reports --single-instance allow only a single instance of the application --clear-cache prevent the application from preserving cache between launches --processEnvs a JSON string of key/value pairs to be set as environment variables before any browser windows are opened. --file-download-options a JSON string of key/value pairs to be set as file download options. See https://github.com/sindresorhus/electron-dl for available options. --tray [start-in-tray] Allow app to stay in system tray. If 'start-in-tray' is given as argument, don't show main window on first start --basic-auth-username basic http(s) auth username --basic-auth-password basic http(s) auth password --always-on-top enable always on top window --title-bar-style (macOS only) set title bar style ('hidden', 'hiddenInset'). Consider injecting custom CSS (via --inject) for better integration. --global-shortcuts JSON file with global shortcut configuration. See https://github.com/jiahaog/nativefier/blob/master/docs/api.md#global-shortcuts -h, --help output usage information
コメント