cssobj-helper-stylize
Apply css text into browser's style tag, can work with cssobj-plugin-gencss.
Usage
var cssobj_core =var gencss =var stylize =var cssobj =// generated css text will be insert into <head>
Install
npm install cssobj/cssobj-helper-stylize
API
stylize(option?: object) -> (result){}
Return a function accept result
and insert result.css
into <style>
tag.
option
-
id
: {string} The id for<style>
tag, if omit, will using random string. -
attrs
: {object} The key/val to apply to<style>
tag as attributes.
RETURN
A function can be used in cssobj onUpdate
option.
Example
// in cssobj({ onUpdate:.... })onUpdate:onUpdate:
Difference between helper-cssom
This helper take simplicy first, just update all css text into <style>
tag, may have performance issues.
plugin-cssom take effiency first, it create every css rule and patch rules with result.diff
If you want apply cssobj once, and don't update result frequently, use plugin-gencss
+ helper-stylize
If you want update result frequently, use plugin-cssom
, it optimized for this type of usage.