A vanilla JavaScript helper to parse JSON into CSS. Formerly known as JOSH.
Arrowhead is a great helper for any web-project which uses CSS. With Arrowhead you can include your CSS either as JSON or as a string right into your HTML or JavaScript without having an additional server-request for your CSS. The result is that you just have to keep track to fewer files and even the performance of your web-project benefits too.
- None
npm install arrowhead
- Download the latest release of Arrowhead here. Paste Arrowhead into your script and you are done.
<script>
/* Copy Arrowhead in your JavaScript! */
Arrowhead.parse({
"#foo": {
"position": "fixed",
"top": 0,
"left": 0,
"background": "#ddd",
"width": "100%",
"height": "4rem"
},
".bar": {
"color": "red",
"background": "#808080"
}
});
</script>
<script>
/* Copy Arrowhead in your JavaScript! */
Arrowhead.parse("#foo{position:fixed;top:0;left:0;background:#ddd;width:100%;height:4rem;}.bar{color:red;background:#808080;}");
</script>
I am using Semantic Versioning 2.0.0 for versioning. For the versions available, see the tags on this repository.
- André Lichtenthäler (Bikossor) - Initial work
This project is licensed under the GPL-3.0 License. See the LICENSE file for more details.
- [Added] Error messages
- [Improved] Security patch (Changed
==
to===
andinnerHTML
totextContent
)
- [Added] Auto-appending to either
head
orbody
(Default:head
) - [Added] Support for css-string
- [Improved] Error checking
- First introduction of Arrowhead