Nitrogen Poisonous Monoxide


    0.1.15 • Public • Published

    Karma JAWR

    npm Build Status Circle CI Status Coverage Status

    Karma + JAWR Integration.

    Concert & Situations

    When you are using J2EE for your web application and using server-render template engine (JSP,JSF,Freemarker,Velocity), you might using some web resource bundling solution.

    JAWR used to be a JavaEE official web resource packing solution in Java way.

    But how can we setup a universal unittest way for JAWR style loading resource way?

    If you are noticed karma is popular with managing frontend javascript side and easily integrated with reporters and CI.

    Here is a karma-plugin to help you generate some commonjs style temp file by parsing So that you can use webpack or other preprocessor for writing frontend unittest in a graceful way.

    JAWR Options

    • configLocation: Absolute path, point to or spring-jawr-context.xml
    • webappLocation: Absolute path, point to your maven war project webapp folder
    • targetLocation: Absolute path, point to a temp build folder, for require syntax
    • localeConfigLocation: Absolute path, optional, if using jawr message generator and using messages: syntax in jawr properties file, suppose to pre-generate by resources bundle and add as global serving files in the karma config.files.



    $ yarn add -D karma-jawr

    Karma Configuration

    1. Add karma-jawr as loaded plugin and framework
    frameworks: [
    1. Add jawr for karma-jawr options to spec the location for your, webapp folder for building war, template generate folder for you customize gitignore path. using mandatory fields configLocation,webappLocation,targetLocation.

    the value must be absolute path.

    jawr: {
      configLocation: pathUtil.resolve('src/main/resources/jawr/') + '',
      webappLocation: pathUtil.resolve('src/main/webapp'),
      targetLocation: pathUtil.resolve('src/test/js/build')

    If you are using jawr provided locale generator for frontend locale string You can also add localeConfigLocation for locating your locale bundle resources.

    Sample Project

    You can refer to this sample project. It using last generation J2EE way web application.

    Using SpringMVC + JSF + JAWR + ExtJs for building a deployable war file.

    And Integrated with and for CI.


    Document And Design

    Please refer to wiki

    Change Log


    • Fix Issue#2 fix issue#2: mapping patterns not support /path/to/ to match non-recurring path to a directory and every resource under it will be added to the bundle


    • Update Dependencies version, and README content at npm


    • Fix defect when locale properties contains empty value while properties default parsed to null


    • Update .last-mappings.json path display, normalizing.


    • Update log level from info to debug.
    • Fix defect when combine bundle jawr bundle names.


    • Fix when mappings in jawr properties including jawr bundle, can not generate correct index.js


    • Performance Tuning: Suppose not generate twice index files when all flatten mapping files no change since last time


    • New features: Add css bundle support, for better requiring style file for debug in browser.
    • Change log level to debug when generating flatten mapping files for ignoring more files.
    • Mini refactor JawrContext design.


    • Fix non-primitive value in locale message properties can not be parse defects.


    • Fix non-composite child key calculate not including itself defects.


    • Fix locale generator generate function key-value duplicate error.
    • Fix locale message mapping detect and filter function.


    npm i karma-jawr

    DownloadsWeekly Downloads






    Unpacked Size

    42.3 kB

    Total Files


    Last publish


    • aquariuslt