jfinal-coffeescript使用java实现coffeescript的动态编译

https://github.com/Dreampie/jfinal-coffeescript    jfinal-coffeescript是一款java下的coffeescript实时编译插件:

<dependency>
      <groupId>cn.dreampie</groupId>
      <artifactId>jfinal-coffeescript</artifactId>
      <version>${jfinal-coffeescript.version}</version>
 </dependency>

目前刚刚发布第一个版本0.1:

<jfinal-coffeescript.version>0.1</jfinal-coffeescript.version>

使用方法:

在jfinal config里configPlugin方法加入

plugins.add(new CoffeeScriptPlugin("/coffeescript/", "/javascript/"));//第一个参数是coffee的文件目录,第二个是输出的js目录

只有这么一句

如果你没有使用jfinal,你可以这么用

setCoffeeScriptCompiler("/coffeescript/", "/javascript/", false, "--bare", true);

private void setCoffeeScriptCompiler(String in, String out, boolean compress, String args, boolean watch) {
    coffeeScriptCompiler = new CoffeeScriptCompiler();
    coffeeScriptCompiler.setBuildContext(ThreadBuildContext.getContext());//js运行环境
    coffeeScriptCompiler.setSourceDirectory(new File(PathKit.getWebRootPath() + in));//输入目录
    coffeeScriptCompiler.setOutputDirectory(new File(PathKit.getWebRootPath() + out));//输出目录
//        coffeeScriptCompiler.setForce(true);
    coffeeScriptCompiler.setCompress(compress);//压缩  暂时不支持
    coffeeScriptCompiler.setArgs(args);//参数 
    coffeeScriptCompiler.setWatch(watch); 是否动态监听文件改动
  }
  
  //上面的代码是初始化插件的参数  使用双线程一个执行,一个监听执行线程 如果执行线程出现错误  监听线程会重启执行线程
  CoffeeExecuteThread run = new CoffeeExecuteThread(coffeeScriptCompiler, restartInterval);
    CoffeeExecuteListener listen = new CoffeeExecuteListener(run);
    run.addObserver(listen);
    new Thread(run).start();

https://github.com/Dreampie?tab=repositories 目录下有多款插件:

cn.dreampie.jfinal-shiro     https://github.com/Dreampie/jfinal-shiro    shiro插件

cn.dreampie.jfinal-shiro-freemarker   https://github.com/Dreampie/jfinal-shiro-freemarker    shiro插件实现的freemarker标签库

cn.dreampie.jfinal-web     https://github.com/Dreampie/jfinal-web   相关web插件,简洁model实现

cn.dreampie.jfinal-utils        https://github.com/Dreampie/jfinal-utils   部分jfinal工具

cn.dreampie.jfinal-tablebind        https://github.com/Dreampie/jfinal-tablebind   jfinal的table自动绑定插件,支持多数据源

cn.dreampie.jfinal-flyway      https://github.com/Dreampie/jfinal-flyway   数据库脚本升级插件,开发中升级应用时,使用脚本同步升级数据库或者回滚

cn.dreampie.jfinal-captcha      https://github.com/Dreampie/jfinal-captcha   基于jfinal render的超简单验证吗插件

cn.dreampie.jfinal-quartz       https://github.com/Dreampie/jfinal-quartz   基于jfinal 的quartz管理器

cn.dreampie.jfinal-sqlinxml      https://github.com/Dreampie/jfinal-sqlinxml   基于jfinal 的类似ibatis的sql语句管理方案

cn.dreampie.jfinal-lesscss       https://github.com/Dreampie/jfinal-lesscss   java实现的lesscsss实时编译插件,可以由于jfinal

cn.dreampie.jfinal-coffeescript     https://github.com/Dreampie/jfinal-coffeescript   java实现的coffeescript实时编译插件,可以由于jfinal 

cn.dreampie.jfinal-akka    https://github.com/Dreampie/jfinal-akka   java使用akka执行异步任务

cn.dreampie.jfinal-mailer       https://github.com/Dreampie/jfinal-mailer   使用akka发布邮件的jfinal插件

cn.dreampie.jfinal-slf4j     https://github.com/Dreampie/jfinal-slf4j   让jfinal使用slf4j的日志api

部分内容借鉴了网络资料


转载于:https://my.oschina.net/Dreampie/blog/312747

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值