weex-style-validator
v0.1.0
Published
weex style validator
Downloads
2
Readme
Weex Style Validator
Check if weex components support the specific styles.
API
configure
: [Function] config the validatorvalidateStyles
: [Function] validate component styles
Usage
Validate styles
const validator = require('weex-style-validator')
/**
* Validate style object.
* @param {Object} style map
*/
validator.validateStyles(styles)
/**
* Validate styles for specific component.
* @param {String} componentName
* @param {Object} style map
*/
validator.validateStyles(componentName, styles)
Config the validator
const validator = require('weex-style-validator')
/**
* Config the validator.
* @param {Object} configure
*/
validator.configure({
// Whether to suppress the warnings in the console.
// Default is false, will print warnings in the console by default.
silent: true,
// Executed when an illegal style is encountered
onfail: function (message) {
// do something ...
}
})
Common Error Output
Weex use display: flex;
by default:
[Style Validator] Not support to use the "display" style property.
Weex doesn't support short-hand properties currently:
[Style Validator] Not support to use the "margin" style property.
[Style Validator] Not support to use the "border" style property.
[Style Validator] <div> is not support to use the "margin" style property.
[Style Validator] <image> is not support to use the "padding" style property.