head-require

2019-10-11 admin

head-require是什么

什么是head-require,Use head.js's script loader like require.js

head-require使用教程帮助文档

HeadRequire.js

Extension for head.js to use resource loader like require.js

Feature

  • Set main.js in script element’s data-main attribute
  • Multiple main.js available now
  • Use head.require() to load resources
  • Grunt task to compile them to a file

Basic Usage

Resource Loader

<script src="scripts/head.js"></script>
<script src="scripts/head-require.js" data-main="scripts/main.js"></script>

“scripts/main.js” like this :

head.require(
	"the/path/to/foojs",
	"the/path/to/bar.js",
	"the/path/to/baz.js"
	"the/path/to/initialize.js"
);

» Learn more about head-require.js

Grunt Task to Compile

Example :

grunt.initConfig({
	headRequire : {
		dist : {
			options : {},
			files : { "the/path/to/dest.js" : "the/path/to/main.js" }
		}
	}
});

» Learn more about Grunt task

CHANGE LOG

» Change Log


Author

mach3

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-77137.html

文章标题:head-require

回到顶部