Skip to content

dillonkrug/require-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

require-sync

NodeJS style require() in the browser. No build necessary.

	<script type="text/javascript" src="../src/require.js"></script>
	<script type="text/javascript">
		

		// include esprima for better debugging.
		var esprima = require("../lib/esprima");

		// this works, but a more effective demonstration is including all of the 75+ source files
		// var jQuery = require("//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min");

		var $ = jQuery = require("js/jquery/jquery");

		$(function() {
			$("body").append("<span>IT WORKED!</span>");
		});
		

	</script>

require('file')

  • relative paths work. Other formats might not.
  • even if you have an index.js, you must specify the file name (no '.js')

About

NodeJS style require() in the browser. No build necessary.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published