title: How to keep Grunt dom_munger from stripping your CDN dependencies?
body: <p>I have an object, <code>Plaid</code>, that is provided by a drop-in module from <a href="https://www.plaid.com/docs/" rel="nofollow">Plaid</a>, called <a href="https://github.com/plaid/link" rel="nofollow">Plaid Link</a>. Locally, the code works perfectly in my AngularJS front-end.</p>
  
  <p>The module is loaded via my AngularJS app's index.html file, right next to all of the other script tags loaded for my application. </p>
  
  <p><strong>Index.html</strong></p>
  
  <pre><code>&lt;script src="https://cdn.plaid.com/link/stable/link-initialize.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p><strong>Here is the code where <code>Plaid</code> is called:</strong> <em>(from an AngularJS controller)</em></p>
  
  <pre><code>$scope.addAccount = function(bankChosen) {
  
      $log.debug("Plaid object: ", Plaid);
      var linkHandler = Plaid.create({ // the troublesome line 
          env: 'tartan',
          clientName: 'Example Project',
          key: 'test_key',
          product: 'connect',
          onSuccess: function(public_token) {
              Restangular.one('plaid').customPOST(
                  {
                      public_token: public_token,
                      user_id: $scope.currentUser.id,
                      institution_code: bankChosen
                  },
                  'addAccount'
              );
          },
          onExit: function() {
              $state.go('dashboard.successState');
          },
      });
  
      linkHandler.open(bankChosen);
  
  };
  </code></pre>
  
  <p>However, when I push to the production environment, currently hosted on Heroku, it gives the javascript error <code>ReferenceError: Plaid is not defined</code> when it tries to load. It is breaking error when deployed to production.</p>
  
  <p><strong>What could be causing this module to be unavailable during production?</strong></p>
  
  <p>The script that loads the CDN could be getting stripped away by a standard grunt task that does that sort of thing? Or maybe I am supposed to be loading the module from the CDN in some other way in a production-environment setting? I really don't know...</p>
  
  <p><strong>Update: I found one thing that might be stripping the loaded module</strong></p>
  
  <p>From the <a href="https://github.com/cgross/grunt-dom-munger" rel="nofollow">Grunt dom-munger docs</a></p>
  
  <blockquote>
    <p>Use this task to read and transform your HTML documents. Typical use cases include:</p>
    
    <ol>
    <li>Read the references from your script or link tags and pass those to
    concat,uglify, etc automatically. </li>
    </ol>
    
    <p><strong>2. Update HTML to remove script
    references or anything that is not intended for your production
    builds.</strong> </p>
    
    <ol start="3">
    <li>Add, update, or remove any DOM elements for any reason.</li>
    </ol>
  </blockquote>
  
  <p><code>dom_munger</code> is part of my application's build process, which happens when it is deployed (!). Grunt is the likely culprit here.</p>
  
  <p><strong>Does anybody know how to load the script tag above, with dom_munger as still part of my app's grunt build step?</strong></p>