hashspace compiler and runtime


Hashspace is a client-side HTML template engine. Its purpose is to provide a powerful and light-weight way to create adanced web-pages containing application logic. Please visit http://hashspace.ariatemplates.com/for more information.

Hashspace is composed of 2 main parts:

  • a file pre-processor that translates the HTML templates into JavaScript functions (cf. compiler test files for the syntax)
  • a runtime library that interprets the compiled templates dynamically

Please refer to the samples in the unit-tests suites in the test/compileror test/rtfolders for more details. The docs/todomvcfolder also contains an implementation of the todomvcapplication (still to be completed to match the full specifications).

To run and update the samples in a live environment, first run npm installand then:

  • run gruntto launch a local web-server that can compile templates on the fly (cf. hsp/gruntfolder)
  • open http://localhost:8000in your favorite browser and choose an example from the sample list
  • or open http://localhost:8000/todomvcto play with the todomvc sample..


Preparing your environment

  • install Grunt cli globally: npm install -g grunt-cli
  • install local npm modules: npm install

Running Tests

For jshint validation:

  • run grunt checkStyle

To run all the tests (compiler and runtime):

  • grunt test

For the compiler test only:

  • run grunt mocha(you can also work in the TDD mode by running grunt watch:mocha)

For the browser-based runtime tests only:

  • run grunt karma:unitto test on local browsers and generate a coverage report
  • run grunt karma:tddto work in the TDD mode
  • run grunt karma:coverageto test on PhantomJS browser and generate a coverage report
  • run grunt karma:sauceto test on SauceLabs browsers

To do the health check on the project (before commit, for example) run grunt test. This will run checkstyle verifications and all the tests (compiler and runtime).

For the browser runtime tests:

  • run grunt tddrt- this will launch a local webserver and a watch task on your files
  • and access http://localhost:8000/test/rtto run the tests in your favorite browsers

Working on the playground

To work on the playground the most simple option is to open 2 terminal windows:

  • one running grunt docs:playgroundto build the playground and launch the webserver
  • another one running grunt docs:watchto watch the file changes and copy the changed files to the hashspace-gh-pages folder that is referenced by the webserver launched in the first terminal

Then you can use http://localhost:8000?dev=truein your favorite browser to get the development version of hashspace



下一篇:uni-app 实现小程序登录注册功能


  • karma-hashspace

    space preprocessors for karma runner karmahashspace =============== Karma plugin for Hashspace ...

    8 个月前


扫码加入 JavaScript 社区