Code Monkey home page Code Monkey logo

abra's Introduction

License: MIT

Abra

A small utility to create HTML elements in JavaScript without a bunch of template strings. Don't call it a framework.

How To

Copy the contents of the abra.js file and plop them either straight into your HTML or include it with a script tag:

<script src="abra.js"></script>

This binds the abra object to the window. You can now create elements like this:

const onclick = () => alert("ITS WORKING!!!");
const isItWorkingButton = abra.button({ onclick }, "Is it working?")
document.body.append(isItWorkingButton)

When should I use Abra?

You should use Abra for small projects where you don't intend to use any frameworks. It should sit in your toolbelt somewhere between vanilla JS and jQuery. I've found that many of my projects fit into that no-dependency area but I don't love doing this all the time:

someDiv.innerHTML = `
  <ul>${listOfThings(item => `<li>${item.value}</li>`).join('')}</ul>
`

because template strings lose a lot of the meaning to my editor and are very bug prone.

When shouldn't I use Abra?

There are a majillion other ways to create elements, many of which can be included via a CDN or installed via NPM. If you include any dependencies using a CDN or NPM, your project is already too complicated for Abra. Use something like jQuery or React instead.

abra's People

Contributors

elliotaplant avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.