Get started with require-text CDN

(MIT OR BSD-3-Clause) licensed

Loads text files as CommonJS modules in Node.js-style apps with require-text library.

Tags:
  • requirejs
  • text

Stable version

Copied!

How to start using require-text CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with require-text CDN - cdnhub.io</title>
  <script src="https://cdn.jsdelivr.net/npm/require/2.2.0/require.min.js"></script>
  <script src="https://cdn.cdnhub.io/require-text/2.0.12/text.min.js"></script>
</head>
<body>
  <script>
    require.config({
      paths: {
        text: 'text'
      }
    });

    require(['text!./myFile.txt'], function(content) {
      console.log('Content of myFile.txt:', content);
    });
  </script>
</body>
</html>
Copied!
Copied!

All versions