简体   繁体   English

Backbone Boilerplate条件评论

[英]Backbone Boilerplate Conditional Comments

Can someone tell me the significance of the conditional comments within the index.html of the Backbone Boilerplate (https://github.com/tbranyen/backbone-boilerplate/blob/master/index.html)? 有人能告诉我在Backbone Boilerplate(https://github.com/tbranyen/backbone-boilerplate/blob/master/index.html)的index.html中条件评论的重要性吗?

<!--(if target dummy)><!--> <link rel="stylesheet" href="/app/styles/index.css"> <!--<!(endif)-->

<!--(if target release)> <link rel="stylesheet" href="index.css"> <!(endif)-->

<!--(if target debug)> <link rel="stylesheet" href="index.css"> <!(endif)-->

<!--(if target dummy)><!-->    <script data-main="/app/config" src="/vendor/js/libs/require.js"></script>    <!--<!(endif)-->

<!--(if target release)>    <script src="require.js"></script>    <!(endif)-->

<!--(if target debug)>    <script src="require.js"></script>    <!(endif)-->

Do they relate to Grunt when building different versions? 在构建不同版本时,它们与Grunt有关吗?

Thanks.. 谢谢..

It looks like you are correct in your assumption that these are Grunt build targets. 看起来你认为这些是Grunt构建目标是正确的。 When building with grunt it must have different settings such as debug, dummy, and release. 使用grunt构建时,它必须具有不同的设置,例如debug,dummy和release。

https://github.com/changer/grunt-targethtml https://github.com/changer/grunt-targethtml

The linked example I found by searching. 我通过搜索找到的链接示例。 It has conditional comments as well with a bit of information. 它还有条件评论以及一些信息。 It then has in the gruntfile.js: 然后它在gruntfile.js中:

// Configuration to be run (and then tested).
targethtml: {
  dev: {
    files: {
      'tmp/dev.html': 'test/fixtures/index.html'
    }
  },
  dist: {
    files: {
      'tmp/dist.html': 'test/fixtures/index.html'
    }
  }
},...

It uses dev and dist as it's conditionals. 它使用dev和dist作为条件。

Backbone Boilerplate defines debug and release (dummy appears to be excluded): Backbone Boilerplate定义调试和发布(虚拟似乎被排除在外):

https://github.com/tbranyen/backbone-boilerplate/blob/master/grunt.js#L131 https://github.com/tbranyen/backbone-boilerplate/blob/master/grunt.js#L131

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

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