question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

It is not immediately clear how one would inject a url for a CDN?

E.g. how might one inject the following:

["http://cdnjs.cloudflare.com/ajax/libs/jasmine/1.3.1/jasmine.js", "./spec/test"]

It would appear that gulp.src() ignores the URL, and I did not see any unit tests corresponding with this functionality.

Many thanks for any thoughts. Cheers.

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
eloonecommented, Dec 7, 2015

@joakimbeng I don’t have anything against modules. It’s just that what I want is so simple, I don’t think I should use another module for that and clutter my stack with it (something less to maintain and to learn for other developers even if it is simple). I think this is something the gulp-inject module should be capable of if we stick to its purpose of “injecting” a file with content, at least that’s what I expect from it when I use it to build my index file.

2reactions
eloonecommented, Dec 4, 2015

Thanks @joakimbeng. In the end I did it like this:

indexStream
      .pipe(inject(gulp.src(''), {
      starttag: '<!-- livereload -->',
      transform: function(){
        return '<script src="http://localhost:35729/livereload.js"></script>';
      },
      empty: true
      }));

And in index file:

<!-- livereload -->
<!-- endinject -->

It does the job without a new module, it’s what I wanted.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to add this CDN Link into HTML - GSAP - GreenSock
So now im at the point that it says to copy/paste the CMD link into HTML: Im trying to figure this out and...
Read more >
How to include CDN in HTML file - javascript - Stack Overflow
How do I link a JavaScript file to a HTML file? Side note: In the above CDN example, the URL starts with //cdn.datatables.net......
Read more >
Adding and Leveraging a CDN on Your Website | CSS-Tricks
Step 1: Choose a CDN and Register Your Site · Step 2: Create your CDN URL · Step 3: Point Your Assets to...
Read more >
How to Import JavaScript and CSS from a Public CDN
A CDN is a Content Delivery Network. These are file hosting services for multiple versions of common libraries. They are usually highly ...
Read more >
How To Add a CDN to Your Website | NimbleWebDeveloper
How To Add a CDN to Your Website · 1. Choose a CDN provider · 1.1 Add AWS User · 2. Configure CDN...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found