# shaken-js

> Shaken, not stirred. A sort of a javascript non-framework.

Latest version **1.0.2** (published 2021-07-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install shaken-js
pnpm add shaken-js
yarn add shaken-js
bun add shaken-js
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2021-07-02 |
| First published | 2021-04-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Manuele Pesenti |
| Maintainers | manuelep |
| Keywords | javascript, vanilla |

## Links

- npm: https://www.npmjs.com/package/shaken-js
- Repository: https://github.com/manuelep/shaken-js
- Homepage: https://manuelep.github.io/shaken-js/
- Issues: https://github.com/manuelep/shaken-js/issues
- npm.io page: https://npm.io/package/shaken-js

## Recent versions

- 1.0.2 (latest) — 2021-07-02
- 1.0.1 — 2021-06-22
- 1.0.0 — 2021-04-06

## README

# Shaken-js
    Shaken, not stirred. A refreshing way to drink JavaScript.

## What's it?

Just a lightweight javascript framework with no future.

## Does it really works?

[So it seams](https://manuelep.github.io/shaken-js/).

## Let's start

### Use a CDN

Shaken-js can be used through [npm](https://www.npmjs.com/package/shaken-js) CDN
service just adding this line to you HTML page.

```html
<script src="https://unpkg.com/shaken-js@1.0.0/shaken.js"></script>
```

## Usage examples

> *WARNING*
> Following examples have not been really tested, but sould work.
> Feel free to open issues about them in case of troubles.

### Easy

* HTML Code
  ```html
  <h2 id="mytitle" class="title item-title is-size-4 has-text-weight-extra-bold" data-name="strDrink">
      My Cocktail
  </h2>
  ```
* Javascript Code
  ```js
  new LocalComponent('mytitle').compile({strDrink: "Vesper Martini"});
  ```

### Less easy

* HTML Code
  ```html
  <table class="table">
    <thead>
        <tr>
          <th>Ingredients</th>
          <th>Measures</th>
        </tr>
    </thead>
    <tbody id="cocktail-ingredients">
        <!-- Content of this tag will be used as a template and repeated looping over ingredients varialbe values -->
        <tr data-name="ingredients">
            <!-- Where ingredient variable value will be shown -->
            <td data-name="ingredient"></td>
            <!-- Where measure variable value will be shown -->
            <td data-name="measure"></td>
        </tr>
    </tbody>
  </table>
  ```

* Javascript Code 1
  ```js
  new LocalComponent('cocktail-ingredients').compile({ingredients: [
      {ingredient: "gin", measure: "3 ounces"},
      {ingredient: "vodka", measure: "1 ounce"},
      {ingredient: "Lillet Blanc", measure: "1/2 ounce"}
  ]});
  ```

### Remote component usage

As alternative the THML element could be retrieved at a certain url, in this case the alternative code should be a bit different:

* Local HTML Code
  ```html
  <div id="cocktail-ingredients-table-here"></div>
  ```
* Remote HTML Code
    See previouse example

* Javascript Code 2
  ```js
  let myComponent = new RemoteComponent('http://somehost.com/path/to/template.html', 'cocktail-ingredients-table-here')
  myComponent.load().then(el=>{
      myComponent.compile({ingredients: [
          {ingredient: "gin", measure: "3 ounces"},
          {ingredient: "vodka", measure: "1 ounce"},
          {ingredient: "Lillet Blanc", measure: "1/2 ounce"}
      ]});
  });
  ```

### Class extensions

Maybe a more profitable way to adopt Shaken-js is to extend their classes adding
custom methods. Here is an [example](https://github.com/manuelep/shaken-js/blob/pages/cocktails.js).

---
_Source: https://npm.io/package/shaken-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
