Currently under development; to begin, please clone this repository first.
Before the installation, please have calmjs installed first so that when python setup.py develop is executed at the root of this package’s repository, the appropriate metadata files defined by the Calmjs framework will also be installed. Failing that, calmjs should also be installed automatically through setuptools, however the egg- info metadata will need to be regenerated by running python setup.py egg_info.
A tutorial will need to be made.
Guidelines will be added as the system is formalized, and they follow:
- Similar to the standard calmjs system, with the difference being the molds system is optimised for the AMD framework as implemented by require.js, and so the option to build packages as AMD modules is permitted, though the standard CommonJS structure should work.
Server-side only templates
These are exposed through the nunja.tmpl registry, and is intended for templates that generate the skeletal markup from which the molds may be nested.
A more formal set of keywords may be developed in the future to better facilitate the above process.
Currently, declaring templates under this registry will be useful for providing static templates across Python package boundaries.
Generally, this involves building a standalone static requirejs AMD artifact file which is then sent to the browsers used by the end-users to be used in conjunction with the packages that provide the molds. Such an artifact that has none of the default nunja.molds that are provided as examples should be generated like so through this invocation of the calmjs command:
$ calmjs rjs --source-registry=calmjs.module nunja
The above command will produce a nunja.js in the current directory that can be included in a <script> tag with the other AMD artifacts that may contain the actual molds.
If one wishes to generate a complete artifact, and assuming the package to be deployed also lists nunja as a Python dependency (here nunja is simply used as an example), the following command can be invoked:
$ calmjs rjs nunja
$ calmjs rjs nunja --optional-advice=nunja
Alternatively, the nunjucks slim library can be bundled instead, which will decrease the size of the final output, but the ability for dynamic template compilation will be disabled on the client side.
$ calmjs rjs nunja --optional-advice=nunja[slim]
Using --bundle-map-method=empty with the rjs tool will result in this error message
$ calmjs rjs nunja --bundle-map-method=empty Tracing dependencies for: /tmp/nunja/nunja.testing.js Error: TypeError: Cannot read property 'normalize' of undefined at Object.<anonymous> (/tmp/nunja/node_modules/requirejs/bin/r.js:1221:35)
This is caused by the provided templates done through the text plugin which is not being provided. To work around this, either ensure the templates registries are NOT provided, or apply the optional advice nunja[slim] to precompile the template and not include the raw source template strings. Alternatively, if the text module is to be made available through a different artifact bundle for a given deployment, the --empty flag may be employed to stub out the missing modules completely, i.e.:
$ calmjs rjs --empty nunja --bundle-map-method=empty
The nunja package is part of the calmjs project.
The calmjs project is copyright (c) 2016 Auckland Bioengineering Institute, University of Auckland. nunja is licensed under the terms of the GPLv2 or later.
- Initial release.
- Provide a base registry for Python-only jinja template registry
- Provide a base registry for nunjucks/jinja compatible template registry.
- A basic rendering system for the artifacts captured by the above base registries.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Hashes for nunja-0.1.0-py2.py3-none-any.whl