简体   繁体   English

在index.html中删除为余烬引擎创建的元标记

[英]Remove meta tag created for ember engine in index.html

I can see meta tag about the config information of the app can be removed from being stored in index.html through this answer . 我可以看到有关应用程序配置信息的元标记可以通过此答案从存储在index.html中的位置删除。

I need the same to be done for my ember-engine. 我需要为余烬引擎做同样的事情。 Currently, this is how my index.html looks. 目前,这就是我的index.html的外观。 It contains the two meta tags: one about the engine's environment.js and the other about the asset-manifest.json. 它包含两个元标记:一个与引擎的environment.js有关,另一个与asset-manifest.json有关。

<meta name="inventory/config/environment" content="%7B%22modulePrefix%22%3A%22inventory%22%2C%22environment%22%3A%22development%22%7D" />
 <meta name="app/config/asset-manifest" content="%7B%22bundles%22%3A%7B%22inventory%22%3A%7B%22assets%22%3A%5B%5D%7D%7D%7D" />

I think your best bet here is creating an in-repo-addon because addons have access to a postprocessTree method. 我认为您最好的选择是创建一个内部仓库插件,因为插件可以访问postprocessTree方法。 It's going to require getting into the Broccoli build though and messing with the html output and I'm not sure exactly what that will look like. 这将需要进入Broccoli构建,并弄乱html输出,但我不确定到底是什么样。

ember g in-repo-addon remove-engine-config

//lib/remove-engine-config/index.js 
'use strict';

module.exports = {
  name: require('./package').name,

  postprocessTree(type, tree) {
    //console.log(type, tree)
    if (type === 'html') { //just guessing on html, it could have a different name
      //do some broccoli manipulation to target and remove the meta tag
      return fancyBroccoli(tree);
    }
  }
};

I'd recommend getting familiar with VS Code and it's excelent debugger because that will let you inspect things as they come into that method, or you can just put a console.log(type, tree) and see what shakes out to start. 我建议您熟悉VS Code,它是一个出色的调试器,因为它可以让您检查进入该方法的内容,或者只需将console.log(type, tree)放进去,看看会发生什么变化。

Here is a good resource for getting started with Broccoli 这是开始使用西兰花的好资源

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

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