Skip to content

Commit

Permalink
Merge pull request #7 from InDIOS/development
Browse files Browse the repository at this point in the history
Bump to version 0.2.0
  • Loading branch information
InDIOS authored Oct 2, 2018
2 parents 618e726 + 7329a83 commit e0cf2f8
Show file tree
Hide file tree
Showing 52 changed files with 6,061 additions and 2,329 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ install:
script:
- npm run build:src
- npm run build:tools
- npm test
cache:
directories:
- "node_modules"
92 changes: 21 additions & 71 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,90 +1,40 @@
# trebor

[![Build Status](https://travis-ci.org/InDIOS/trebor.svg?branch=master)](https://travis-ci.org/InDIOS/trebor)
[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Release][github-img]][github-url]
[![Build Status][travis-image]][travis-url]

A node js module to make standalone web components.

# How to use

## How to install
Locally
```bash
npm i trebor -D
```
or
or globally

```bash
npm i trebor -g
```

# Example

### Let's make a `Counter` component:

First we'll make an html file with name `counter`.
```html
<!-- counter.html -->
<style>
.negative {
color: crimson;
}
</style>

<div class="container">
<h3 class="title is-3">Counter Example</h3>
<label>Counter: </label>
<strong :class="negative">{{ count }}</strong>
<br/>
<button class="button is-primary" @click="increment()">Increment</button>
<button class="button is-danger" @click="decrement()">Decrement</button>
</div>
## Documentation

<script>
export default {
model: {
count: 0,
get negative() {
return { 'negative': this.count < 0 };
},
increment() {
this.$set('count', this.count + 1);
},
decrement() {
this.$set('count', this.count - 1);
}
}
};
</script>
```
Then we'll compile the `counter` file to convert it in a standalone component
Read the documentation [here](https://github.com/InDIOS/trebor/wiki)

```bash
trebor -i counter.html
```
In the directory will appear one `js` file with `umd` sufix. Make a file named `index.html` like that
## Contributions

```html
<!DOCTYPE html>
<html lang="en">
>TO-DO
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Counter Component</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.5.0/css/bulma.min.css">
</head>
## License

<body>
<main></main>

<!-- Load Counter component -->
<script src="counter.umd.js"></script>
<!-- Initialize and Mount Counter component -->
<script>
var counter = new Counter();
counter.$mount('main');
</script>
</body>
[MIT](https://github.com/InDIOS/trebor/blob/master/LICENSE)

</html>
```
Open the `index.html` file in the browser and see how the magic happens 🎉👍😁
[npm-image]: https://img.shields.io/npm/v/trebor.svg
[npm-url]: https://npmjs.org/package/trebor
[downloads-image]: https://img.shields.io/npm/dm/trebor.svg
[downloads-url]: https://npmjs.org/package/trebor
[github-img]: https://img.shields.io/github/release/InDIOS/trebor.svg
[github-url]: https://github.com/InDIOS/trebor/releases/latest
[travis-image]: https://img.shields.io/travis/InDIOS/trebor/master.svg?label=build
[travis-url]: https://travis-ci.org/InDIOS/trebor
2 changes: 1 addition & 1 deletion bin/trebor.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const options = yargs.options({
format: {
alias: 'f',
type: 'string',
choices: ['es', 'iif', 'umd', 'amd', 'system'],
choices: ['es', 'iif', 'umd', 'amd', 'cjs', 'system'],
describe: 'Format of the output.'
},
minify: {
Expand Down
3 changes: 2 additions & 1 deletion loader.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const { extname, basename } = require('path');
const { getOptions } = require('loader-utils');
const { transpileModule } = require('typescript');
const { genSource, optimize, exportFormat } = require('./build');
const { genSource, exportFormat } = require('./build');
const { optimize } = require('./build/utilities/context');
const { kebabToCamelCases, capitalize } = require('./build/utilities/tools');

module.exports = function (code, map, meta) {
Expand Down
Loading

0 comments on commit e0cf2f8

Please sign in to comment.