cssobjectjs
Version:
A Parser CSS in Javascript Vanilla
28 lines (23 loc) • 853 B
JavaScript
import CSSObject from "../CSSObject/CSSObject.js"
// to show cssobj stylesheet on page
let div = document.querySelector('.cssobject')
const printJSON = (style) => {
// shows in console
console.log(style)
let cssjson = JSON.stringify(style, null, ' ')
let pre = document.createElement('pre'),
code = document.createElement('code')
code.innerText = cssjson
pre.appendChild(code)
div.appendChild(pre)
}
// instance css object
let cssobj = new CSSObject()
// set options
cssobj.options({ load_min: false, ignore_files: ['demo.css', 'card.css'] })
// get external stylesheets
.external(style => printJSON(style))
// get local stylesheets
.local(style => printJSON(style))
// static stylesheet
.static(".blob { background-color: #d7d7d7; }", style => printJSON(style))