观看并重新加载聚合物发球/聚发球?
Watch and reaload for polymer serve / polyserve?
我正在想办法将 polyserve / polymer-cli to reload my browser each time a "watched" file changes but I haven't found anything apart of adding Livereload 制作成 HTMLs 文件,我认为这些文件会变得一团糟,因为在开发 Web 组件时我会单独加载 HTML 个文件。
要在您的项目中使用 Polymer CLI 作为服务器自动重新加载,您应该在本地安装 node / yarn installed. Then you need to install browser-sync。
npm install -D browser-sync
或
yarn add browser-sync --dev
您的 package.json
文件需要类似于:
{
"name": "MY-ELEMENT",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"start": "npm run serve | npm run watch",
"serve": "polymer serve --port 8080",
"test": "polymer test",
"watch": "browser-sync start --proxy localhost:8080 --open --startPath \"components/MY-ELEMENT\" --files \"**/*.html\""
},
"devDependencies": {
"browser-sync": "^2.18.13"
}
}
(如果它是一个常规的 Polymer 应用程序,您应该删除 --startPath
参数,因为它用于 Polymer 组件开发)
我正在使用 polyserve-watch
,它使用 polyserve 和 browser-sync`` 监视、提供和重新加载 Web 组件。
此致
我正在想办法将 polyserve / polymer-cli to reload my browser each time a "watched" file changes but I haven't found anything apart of adding Livereload 制作成 HTMLs 文件,我认为这些文件会变得一团糟,因为在开发 Web 组件时我会单独加载 HTML 个文件。
要在您的项目中使用 Polymer CLI 作为服务器自动重新加载,您应该在本地安装 node / yarn installed. Then you need to install browser-sync。
npm install -D browser-sync
或
yarn add browser-sync --dev
您的 package.json
文件需要类似于:
{
"name": "MY-ELEMENT",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"start": "npm run serve | npm run watch",
"serve": "polymer serve --port 8080",
"test": "polymer test",
"watch": "browser-sync start --proxy localhost:8080 --open --startPath \"components/MY-ELEMENT\" --files \"**/*.html\""
},
"devDependencies": {
"browser-sync": "^2.18.13"
}
}
(如果它是一个常规的 Polymer 应用程序,您应该删除 --startPath
参数,因为它用于 Polymer 组件开发)
我正在使用 polyserve-watch
,它使用 polyserve 和 browser-sync`` 监视、提供和重新加载 Web 组件。
此致