Announcement

Collapse
No announcement yet.

Compile only what is used?

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

    Compile only what is used?

    I would love to use Bridge.Net for my smaller projects as it helps keep JS really organized and clean with it being in C#. However, for a small website that probably only wants a few animations, a bit of ajax and some basic JS stuff, having Bridge.Net output a 1MB file containing all of .Net features it's overkill.

    Do you have support yet for the compiler removing all unused stuff from the bridge js file?

    #2
    You could use tree shaking to remove unused code as some kind of post build step.
    Since Bridge.NET simply compiles to javascript -- Any javascript tree shaking tool might work for you to accomplish this.

    [Edit]
    Although this could work -- not sure how it would work in the single .js file case -- The Bridge team might have to implement or call a shaker during parsing.

    But it may be possible to do this with a single file or other ridge options...
    Last edited by selinc; 2018-01-29 @ 05:49 PM.

    Comment


      #3
      Any javascript tree shaking tool might work for you to accomplish this.
      It's not that simple.

      having Bridge.Net output a 1MB file containing all of .Net features it's overkill.
      Currently, bridge.min.js is 627KB and with your server gzip compression turned on, it's ~140KB. We will be implementing functionality to help reduce the size of bridge.js, but current bridge.min.js + gzip is about 86% smaller than the 1MB size stated above.

      You should only be using the bridge.js file during development and debugging. For a production app, or Release Mode, please ensure you are including bridge.min.js.

      Comment


        #4
        Great, that is good for me to know as well.

        Thanks!

        Comment

        Working...
        X