jjs是把html、css、debugjs、ajax响应、依赖嵌入到js注释中,从而免去搭建具体开发环境的工具。为插件开发者、学生、教师提供难以言说的便利感受。
下面是用jjs开发helloworld插件,该插件的作用是搜索文档并把class为helloworld的div元素中现实“你好世界”字样。
1、在dev文件夹下新建utf-8格式的文件helloworld.js内容如下:
/*{debug-html}
// 用于调试的html文件
<div class="helloworld"></div>
<div class="helloworld"></div>
<div class="helloworld"></div>
{:debug-html}*/
/*{debug-css}
// 用于调试的css文件
.helloworld{
width:100px;
height:100px;
font-size:50px;
}
{:debug-css}*/
var dom = document.getElementsByTagName( 'div' );
for( var i = 0,len = dom.length ; i < len ; i++ ){
(function(){
dom[ i ].innerHTML = 'HelloWorld';
})();
}
2、单击根目录下的makejs.bat
3、在浏览器中输入127.0.0.1:3000/debug.html检查你的工作吧