3
我正在使用Asset Pipeline來構建一些JavaScript,這些JavaScript將被移交給許多第三方開發人員。我想在生成的(也可能是混淆的)輸出文件的頂部放置警告註釋,但不清楚如何使用鏈接/ coffeescript組合來實現此目的。如何將樣板註釋或許可添加到使用Rails 3.1 Asset Pipeline編譯的JavaScript文件的頂部?
# This is a manifest file that'll be compiled into including all the files listed below.
# Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
# be included in the compiled file accessible from http://example.com/assets/application.js
# It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
# the compiled file.
###
The following code was compiled from source by MF.
Please do not edit this JavaScript directly.
####
#= require util/extensions
#= require util/date_manipulation
#= require util/format
#= require points_data
#= require graphics/canvas_graphics
#= require graphics/explorer_canvas_graphics
#= require renderer
我得到這個結果如下:
(function() {
/*
The following code was compiled from source by MF.
Please do not edit this JavaScript directly.
*/
}).call(this);
我想是這樣的(或者相近):
/*
The following code was compiled from source by MF.
Please do not edit this JavaScript directly.
*/
(function() {
// ******** my compiled code from all those required files! *******
}).call(this);
How'm'I會得到這個工作?
我顯然不希望編譯後的任何手動步驟 - 所以我會在哪裏添加此評論? –
如果你在本地進行預編譯,你需要把它放在application.rb中。我會把你的特別評論放在它自己的文件中,並且首先在清單中加入。在文件中使用/ *註釋語法* /。 –
版權標誌默認爲true。其他事情正在發生。 – Jason