Build Status

Montage Require

This is a CommonJS module system, highly compatible with NodeJS, intended for front-end development of web applications using npm style packages. It is designed to be automatically replaced by the Montage Optimizer with a smaller, faster and bundled production module system.

Mr is installed as a package in your application using npm:

$ npm init                  # if you don't already have a package.json
$ npm install --save mr

In an HTML file next to your package.json add the Mr script and provide a module to load:

<script src="node_modules/mr/bootstrap.js" data-module="index"></script>

Start writing your code in index.js, using the require function as you would in Node. Have a look at the demo for working example.

You can place your package.json in a different location, or avoid having one at all, with other script tag attributes.

Optimization

Take a look at Mop, the Montage Optimizer to optimize applications for production. The optimizer can bundle packages with all of the dependent modules, can preload bundles of progressive enhancements in phases, and can generate HTML5 application cache manifests.

Documentation

Mr is compatible with Node and npm, although there are some differences.

There is documentation for:

And you may be interested in an in-depth look at how Mr works.

Compatibility

At present, Mr depends on document.querySelector and probably several other recent EcmaScript methods that might not be available in legacy browsers. With your help, I intend to isolate and fix these bugs.

At time of writing, tests pass in Chrome 21, Safari 5.1.5, and Firefox 13 on Mac OS 10.6.

Maintenance

Tests are in the spec directory. Use npm test to run the tests in PhantomJS or open spec/run.html in a browser.

This implementation is a part from Motorola Mobility’s Montage web application framework. The module system was written by Tom Robinson and Kris Kowal. Motorola holds the copyright on much of the original content, and provided it as open source under the permissive BSD 3-Clause license. This project is maintained by Kris Kowal and Stuart Knightley, continuing with that license.



建立状态

Montage Require

这是一个CommonJS模块系统,与NodeJS高度兼容, 旨在使用npm风格的Web应用程序的前端开发 包装它被设计为由蒙太奇自动替换 优化器具有更小,更快和捆绑的生产模块系统。

Mr在您的应用程序中使用npm:

作为包安装
$ npm init                  # if you don't already have a package.json
$ npm install –save mr

在您的 package.json 旁边的HTML文件中,添加Mr脚本并提供a 模块加载:

<script src="node_modules/mr/bootstrap.js" data-module="index"></script>

开始在 index.js 中编写代码,使用 require 函数 将在Node中。看看演示 作为实例。

您可以将 package.json 放在不同的位置,或避免有一个 其他脚本标签属性也是如此。

优化

查看 Mop,Montage Optimizer 优化生产应用。优化器可以捆绑包 所有的依赖模块都可以预先加载捆绑的渐进增强功能 分阶段,并可以生成HTML5应用程序缓存清单。

文件

Mr先生与Node和npm 兼容,虽然 有一些区别。

有以下文档:

您可能有兴趣深入了解工作原理

兼容性

目前,Mr依赖于 document.querySelector 和 可能还有其他几种最近的EcmaScript方法可能不是 在传统浏览器中可用。在你的帮助下,我打算孤立和 修复这些错误。

在撰写本文时,测试通过Chrome 21,Safari 5.1.5和Firefox 13在Mac OS 10.6上。

维护

测试在 spec 目录中。使用 npm test 来运行测试 PhantomJS或在浏览器中打开 spec / run.html

此实施是摩托罗拉移动的蒙太奇网站的一部分 应用框架。模块系统由Tom Robinson撰写 和Kris Kowal。摩托罗拉拥有原有的许多版权 内容,并在允许的BSD下将其提供为开源 3条许可证。这个项目由Kris Kowal和Stuart维护 奈特利,继续执照。




相关问题推荐