Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
chicoxyzzy committed Dec 21, 2022
1 parent 1a3c722 commit cb8b0f4
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 1 deletion.
8 changes: 8 additions & 0 deletions HELP.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

### Class Name Mangling

To avoid class name mangling issues, we recommend using the second parameter in `Tonic.add` method:

```js
Tonic.add(MyComponent, 'my-component')
```

---

If you are using Uglify (or something similar), it will mangle your class names.
To fix this, just pass the `keep_fnames` option babel-minify has something
similar.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
THE MIT LICENSE (MIT)

Copyright © 2018 Paolo Fragomeni <paolo@async.ly>
Copyright © 2018 Paolo Fragomeni <paolo@socketsupply.co>

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the “Software”), to deal in
Expand Down
10 changes: 10 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# Migration from v13 or v14 to v15

In version 15 we've migrated to ES modules and dropped support for CommonJS.
You still can use CommonJS if you want with the help of bundlers like esbuild,
Webpack or Rollup.

There's a few breaking changes in this release: `Tonic.version`, `Tonic.SPREAD`, `Tonic.ESC`, `Tonic.AsyncFunctionGenerator`, `AsyncFunction` and `Tonic.MAP` are getters now. This change shouldn't affect most of developers.

Bundle size was reduced as we don't bundle `package.json` anymore and set the version on a build step.

# Migration from v12 to v13

We enabled escaping on strings returned by `render()`
Expand Down
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,47 @@
</p>
<br/>
<br/>
Tonic is a low profile component framework for the web. It's one file, less than 3kb gzipped and has no dependencies. It's designed to be used with modern Javascript and is compatible with all modern browsers and built on top of the Web Components.

## Installation

```sh
npm install @socketsupply/tonic
```

## Usage

```js
import Tonic from '@socketsupply/tonic'

class MyGreeting extends Tonic {
render () {
return this.html`<div>Hello, World.</div>`
}
}

Tonic.add(MyGreeting, 'my-greeting')
```

After adding your Javascript to your HTML, you can use your component anywhere.

```html
<html>
<head>
<script src="my-greeting.js"></script>
</head>
<body>
<my-greeting></my-greeting>
</body>
</html>
```

# Useful links
- [Tonic components](https://github.com/socketsupply/components)
- [Migration from the early versions of Tonic](./MIGRATION.md)
- [API](./API.md)
- [Troubleshooting](./HELP.md)

Copyright (c) 2022 Socket Supply, Inc.

MIT License

0 comments on commit cb8b0f4

Please sign in to comment.