angularjs2 cli,构建chrome扩展,定义内容和背景问题的麻烦 [英] angularjs2 cli, building chrome extension, troubles to defining content and background sripts
问题描述
假设我使用 angularjs-2 nofollow noreferrer> cli ,
,以便 ng build
it 将我的来源建立为 / dist
文件夹。
由于我正在构建chrome扩展,因此 manifest.json
,我必须定义我的内容脚本(加载页面)和位置是后台脚本/活动页面(加载一次)。
所以我必须在我的 manifest.json
中定义它们,
content_scripts:[
{
matches:[*],
css:[content-script.css],
js:[content-script.js]
}
background:{
scripts:[eventPage.js],
每个sistent:false
},
麻烦的是当我配置 有一个脚本部分,我可以在其中放置我的内容脚本 然后(不管它是一个文件还是多个文件)它都会在一个dist / scripts.bundle.js中进行编译 然后在我的manifest.json中,我必须设置: 但是..正如我所说,只有一个 这听起来对我来说就像为了构建一个带有angularjs 2的插件一样,我实际上需要3个angulaj应用程序的构建应用程序: (当我说 CLI似乎没有不支持? 分享我认为合适的答案: 题外话: 同时,如此处所述。考虑到我的后端是在 Say I've generated a new Since I'm building chrome extension, in So I have to define them in my The trouble is that when I configure There is a script section, where I can put my content-script then (whether it is one file or more) it will compile all in one dist/scripts.bundle.js So then in my manifest.json I have to set:
"content_scripts": [ But.. as I said there is only one That all sounds to me like as if in order to build a plugin with angularjs 2, I actually need build application with 3 angulaj apps in it: (when I say CLI seems does not support it?
Are there any ways (others than not using CLI)? To share my opinionated answer that fits my needs: Off-topic: But.. at the same time, as said here. Taking unto account that my back-end is on 这篇关于angularjs2 cli,构建chrome扩展,定义内容和背景问题的麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! .angular-cli.json
通过 ng build $定义应放入
/ dist
文件夹的内容
scripts:[
content-script.ts
],
content_scripts:[b]
{
matches:[*],
css:[mystyles.css],
js:[scripts.bundle.js]
}
scripts.bundle.js
。那么我应该怎么做背景/活动页面呢? (当我需要内容时,我无法加载背景,反之亦然)。
$ b
app
,我的意思是angularjs2应用程序)
有没有其他方法(其他方式不使用CLI)?
scala
和我一个人在项目上。然后我宁愿去 scalajs
和 scalajs + react +材质组件看起来比我想象的要快(我很惊讶),而构建系统就像我想要的那样构建我的chrome dist。会试试看。 [对于所有不是真正的js开发人员可能会感兴趣。] angularjs-2
app with cli,
so that with ng build
it builds my sources to /dist
folder.manifest.json
, I have to define where is my content-script (that loads with page) and where is background script/ event page (that loads once).manifest.json
, "content_scripts": [
{
"matches": ["*"],
"css": ["content-script.css"],
"js": ["content-script.js"]
}
"background": {
"scripts": ["eventPage.js"],
"persistent": false
},
.angular-cli.json
to define what should be placed into /dist
folder by ng build
I'm a bit puzzled what to put where. "scripts": [
"content-script.ts"
],
{
"matches": ["*"],
"css": ["mystyles.css"],
"js": ["scripts.bundle.js"]
}
scripts.bundle.js
. What should I do for background /event page then ? (I can not load background one when I need content and vise versa).
app
, I mean angularjs2 app)
scala
and I one-man-on-the-project. Then I would rather go with scalajs
and scalajs + react + material components seems that is growing faster than I thought (I'm surprised), and the build system as sbt would build me my chrome dist as I want so. Will give it a try. [It may be interesting for all "not-really-js-developers".]