Announcement

Collapse
No announcement yet.

[CLOSED] [#809] Prepend output with comment

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    [CLOSED] [#809] Prepend output with comment

    Hi!

    I'm trying to prepend the output of the code (the code is using "combineScripts": true) with a comment.

    This is what needs to be on top of the code:

    // ==UserScript==
    // @name        --
    // @author      --
    // @namespace   --
    // @description --
    // @include     --
    // @version     0.01
    // @downloadURL --
    // @grant       GM_addStyle
    // @grant       GM_xmlhttpRequest
    // @grant       GM_getValue
    // @grant       GM_setValue
    // @grant       GM_log
    // @grant       GM_info
    // @require     https://code.jquery.com/jquery-2.1.4.min.js
    // @require     https://labs.appshield.io/DeadCode/HF-AIO/raw/master/ext/GMSuperValues.user.js
    // ==/UserScript==

    How can I do so with Visual Studio, or does the JSON have an option for this?

    #2
    Hello,

    At the moment this functionality is not supported within Bridge.NET, but with the upcoming v1.11 release, we will be adding functionality to the [Init] Attribute to enable. More info on the [Init] Attribute is available in the Knowledge Base Attribute Reference.

    For example, the following sample demonstrates how this new Enum value will be configured in .cs, and then below demonstrates the proposed compiled .js.

    Example (.cs)

    public class App
    {
        [Init(InitPosition.Top)]
        public static void Top()
        {
            // Your comment and code
            Console.Log("Init Top");
        }
    }
    Example (.js)

    // Your comment and code
    console.log("Init Top");
    
    /* global Bridge */
    
    Bridge.define('Demo.App');
    
    Bridge.init();
    Any code or comments within the Method body will be rendered directly to the top of the compiled .js file, and will NOT be wrapped in a function closure. This will enable total flexibility in rendering content to the top of the file.

    There will also be an InitPosition.Bottom Enum value, which will render the Method body contents directly to the bottom of the file.

    The 1.11 Milestone status can be tracked at:

    https://github.com/bridgedotnet/Bridge/milestones/1.11

    To work-around this Bridge limitation right now, you could add the comments to another .js file, then combine the files through some bundling software, such as Gulp or Grunt.

    Hope this helps.
    Last edited by geoffrey.mcgill; 2016-03-15 @ 06:02 PM.

    Comment


      #3
      Created an Issue:
      https://github.com/bridgedotnet/Bridge/issues/809

      Comment

      Working...
      X