diff --git a/docs/closure_compilation.md b/docs/closure_compilation.md index 7502d51cf747ae..540abf6cb4a027 100644 --- a/docs/closure_compilation.md +++ b/docs/closure_compilation.md @@ -18,7 +18,7 @@ On Mac or Windows, visit: We use GYP and ninja as our build system. To generate the ninja files from GYP: ```shell -# notice the 2 in compiled_resources.gyp +# notice the 2 in compiled_resources2.gyp GYP_GENERATORS=ninja tools/gyp/gyp --depth . third_party/closure_compiler/compiled_resources2.gyp ``` @@ -99,29 +99,23 @@ alert(mensa); // '100 IQ50' instead of 150 In order to check that our code acts as we'd expect, we can create a - my_project/compiled_resources.gyp + my_project/compiled_resources2.gyp with the contents: ``` -# Copyright 2015 The Chromium Authors. All rights reserved. +# Copyright 2016 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. { 'targets': [ { 'target_name': 'my_file', # file name without ".js" - - 'variables': { # Only use if necessary (no need to specify empty lists). - 'depends': [ - 'other_file.js', # or 'other_project/compiled_resources.gyp:target', - ], - 'externs': [ - '<(CLOSURE_DIR)/externs/any_needed_externs.js' # e.g. chrome.send(), chrome.app.window, etc. - ], - }, - - 'includes': ['../third_party/closure_compiler/compile_js.gypi'], + 'dependencies': [ # No need to specify empty lists. + '../compiled_resources2.gyp:other_file', + '<(EXTERNS_GYP):any_needed_externs' # e.g. chrome.send(), chrome.app.window, etc. + ], + 'includes': ['../third_party/closure_compiler/compile_js2.gypi'], }, ], } @@ -154,7 +148,7 @@ like this: 'target_name': 'compile_all_resources', 'dependencies': [ # ... other projects ... -++ '../my_project/compiled_resources.gyp:*', +++ '../my_project/compiled_resources2.gyp:*', ], } ] @@ -172,7 +166,7 @@ Compiled JavaScript is output in map for use in debugging. In order to use the compiled JavaScript, we can create a - my_project/my_project_resources.gpy + my_project/my_project_resources.gyp with the contents: @@ -225,6 +219,7 @@ with the contents: ``` In your C++, the resource can be retrieved like this: + ``` base::string16 my_script = base::UTF8ToUTF16( @@ -287,6 +282,7 @@ my_project/compiled_resources.gyp ``` with contents similar to this: + ``` # Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be