简体   繁体   English

开发浏览器扩展 Angular 5/6; 教程; 指导

[英]Develop Browser Extensions Angular 5/6; Tutorial; Guide

I would like to ask you a simple but very important question.我想问你一个简单但非常重要的问题。 I have been working recently on a project, where I would like to develop a chrome or browser extension.我最近一直在做一个项目,我想开发一个 chrome 或浏览器扩展。 I would like to use here the Angular Framework, as it's just fantastic and I have been working with it frequently.我想在这里使用 Angular 框架,因为它太棒了,而且我经常使用它。 I would like to develop the extension in Angular and found only 2 interesting tutorials on how to perform this.我想在 Angular 中开发扩展,但只找到了 2 个关于如何执行此操作的有趣教程。 However, they are mostly outdated.然而,它们大多已经过时。 I know that I need only the following files at least:我知道我至少只需要以下文件:

  • manifest.json清单文件
  • index.html (or popup.html) index.html(或 popup.html)

However, there is still more like the content-script.js or the event page in the background.然而,更多的还是像 content-script.js 或者后台的事件页面。 Angular is in typescript and I have found a gulp taks, that bundles and builds me a single content-script. Angular 在打字稿中,我找到了一个 gulp taks,它捆绑并为我构建了一个单一的内容脚本。 Anyway I would like to ask you if you have any projects/experience or tutorials and help for developing a browser or chrome extension with Angular 5/6 and the latest CLI and tools?无论如何,我想问您是否有任何项目/经验或教程以及使用 Angular 5/6 和最新的 CLI 和工具开发浏览器或 Chrome 扩展的帮助?

After project setup these steps you have to follow here.项目设置完成后,您必须在此处执行这些步骤。

  • Run command “ng build” (lets create you Build for your project in order to publish, this creates dist folder in your project)运行命令“ng build”(让我们为您的项目创建 Build 以便发布,这会在您的项目中创建 dist 文件夹)
  • Create manifest.json file in the dist folder.在 dist 文件夹中创建 manifest.json 文件。 (Basic format given below) (基本格式如下)

     { “manifest_version”: 2, “name”: “ng2 Extension”, “description”: “Todo app as chrome extension using angular4”, “version”: “1.0”, “browser_action”: { “default_icon”: “icon.png”, “default_popup”: “index.html” }, “permissions”: [], “content_security_policy”: “script-src 'self' 'unsafe-eval'; object-src 'self'”, “web_accessible_resources”: [ “assets/css/*”, “assets/js/*”, “assets/fonts/*” ] }

For more information read out here -有关更多信息,请在此处阅读 -

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM