2013-01-17 54 views
3

有人能告訴我在Backbone Boilerplate(https://github.com/tbranyen/backbone-boilerplate/blob/master/index.html)的index.html中的條件註釋的意義嗎?Backbone Boilerplate有條件註釋

<!--(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)--> 

它們在構建不同版本時與Grunt有關嗎?

謝謝..

回答

5

看起來你是在你的假設是正確的,這些都是咕嚕構建目標。當用grunt進行構建時,它必須具有不同的設置,如調試,虛擬和發佈。

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

鏈接的例子,我發現通過搜索。它有條件的評論以及一些信息。然後它在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' 
    } 
    } 
},... 

它使用dev和dist作爲條件。

骨幹樣板定義調試和發佈(假人似乎被排除):

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

+0

點上 - 謝謝! – mindwire22