@nativescript-community/xml-ui-loader
v3.3.1-alpha.3
Published
A webpack loader that works as an ahead-of-time (AOT) compiler which turns XML content into JavaScript during the build phase.
Downloads
120
Readme
@nativescript-community/xml-ui-loader
This loader provides support for using @nativescript-community/xml-ui-compiler in Webpack.
Installation
npm install @nativescript-community/xml-ui-loader --save-dev
Usage
webpack.config.js
const webpack = require('@nativescript/webpack');
const { getEntryDirPath, getPlatformName } = require('@nativescript/webpack/dist/helpers/platform');
const { chainLoaderConfiguration } = require("@nativescript-community/xml-ui-loader/helpers");
module.exports = (env) => {
webpack.init(env);
// Learn how to customize:
// https://docs.nativescript.org/webpack
webpack.chainWebpack((config) => {
chainLoaderConfiguration(config, {
appPath: getEntryDirPath(),
platform: getPlatformName()
});
});
return webpack.resolveConfig();
};
There are also few preprocessing options that are useful for applying output customizations.
chainLoaderConfiguration(config, {
appPath: getEntryDirPath(),
platform: getPlatformName(),
useDataBinding: false, // Set this to false if you don't want to use data binding system
preprocess: {
// Format attribute value
attributeValueFormatter: (value, attributeName, tagName, attributes) => value.toUpperCase(),
// Manage AST result
transformAst: (ast, generateFunc) => generateFunc(ast).code,
}
});