Registry / devops / kissy-xtemplate

kissy-xtemplate

JSON →
library0.4.3jsnpmunverified

Independent XTemplate compiler for KISSY, version 0.4.3 (last updated circa 2014). Compiles .xtpl.html templates to .xtpl.js for use with KISSY MVC. Supports multiple KISSY versions (1.4.x, 1.5.x, 5.x alpha, kg-*). Provides both Node.js and CLI interfaces. No releases since 2014; considered stale. Alternatives include handlebars or built-in template engines.

npm install kissy-xtemplate
INSTALL
IMPORT
SIG · KISSY-XTEMPLATE
K
kissy-xtemplate
devopsjavascriptv0.4.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

XTemplate
var XTemplate = require('kissy-xtemplate');
import XTemplate from 'kissy-xtemplate';
No default ESM export; use CommonJS require.
xtemplate CLI
xtemplate a.xtpl.html a.js
xtemplate a.xtpl.html -o a.js
CLI expects two positional arguments: source and destination. No -o flag.
new XTemplate(options)
var compiler = new XTemplate({ version: '1.5.0', inputCharset: 'gbk' });
var compiler = new XTemplate('1.5.0');
Options must be passed as an object, not a string.

Shows basic usage: create a compiler instance and compile a template file synchronously or asynchronously.

var XTemplate = require('kissy-xtemplate'); var compiler = new XTemplate(); // Synchronous compile compiler.compileSync('template.xtpl.html', 'template.xtpl.js'); // Asynchronous compile compiler.compile('template.xtpl.html', function(err) { if (err) console.error(err); });
Debug
Known issues
deprecatedPackage is no longer maintained. No updates since 2014.
fix
Migrate to a maintained template compiler such as Handlebars or use KISSY's built-in template support.
affects: >=0.0.0
breakingKISSY version options such as '5.0.0-alpha.10' may not be fully supported and could cause compilation failures.
fix
Use a version from the supported list: 1.4.0, 1.4.1, 1.4.2, 1.5.0, kg-4.1.4, kg-4.2.0, kg-4.2.1.
affects: >=0.4.0
gotchaThe CLI command expects two positional arguments; using flags like -o will be ignored.
fix
Use 'xtemplate source.xtpl.html dest.js' not 'xtemplate -o dest.js source.xtpl.html'.
affects: >=0.0.0
gotchaString encoding options (inputCharset, outputCharset) default to utf-8, but if you specify 'gbk' make sure your files are actually GBK encoded.
fix
Ensure your template files are in the declared charset to avoid garbled output.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'kissy-xtemplate'
Package not installed or not in node_modules.
fix
Run 'npm install kissy-xtemplate --save' and ensure you are in the correct directory.
TypeError: object is not a function
Incorrect import style; using ES6 import instead of require.
fix
Use 'var XTemplate = require('kissy-xtemplate');' instead of 'import XTemplate from 'kissy-xtemplate';'
xtemplate: error: unknown option `--output'
Using a flag that does not exist in the CLI.
fix
Use positional arguments: 'xtemplate input.xtpl.html output.js'
Error: Cannot find module 'uglify-js'
Missing dependency (kissy-xtemplate may have peerDependencies not listed).
fix
Install uglify-js: 'npm install uglify-js --save'
Upgrade
Version history
0.4.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
3 hits · last 30 days
node
2
Resources
kissy-xtemplate — npm install kissy-xtemplate · libregistry