Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/arggh/blaze-teleport

Teleporting capabilities for Meteor's Blaze
https://github.com/arggh/blaze-teleport

Last synced: 5 days ago
JSON representation

Teleporting capabilities for Meteor's Blaze

Awesome Lists containing this project

README

        


Teleport for Meteor's Blaze

**Teleport** renders your Blaze templates wherever you feel like!

```handlebars


{{#Teleport destination='body'}}

I will be rendered in document's body


{{/Teleport}}

```

- Render stuff outside of your app's DOM tree.
- Handy for preventing style cascade or glitches with layering.
- Great for modals or dialogs.
- Tiny footprint. Well below 1kB compiled and minified.
- Has a logo.

## How to install

```bash
$ meteor add arggh:teleport
```

## How to use

**Teleport** will register a new Blaze template that is used as a block helper. Anything you put inside it will get magically teleported to the requested destination.

```handlebars

{{#Teleport destination=target}}
{{> TextBox content="bar"}}
{{/Teleport}}

```

`destination` is optional and defaults to `document.body`. If provided, it should be either a DOM Element or a CSS selector.

```handlebars

{{#Teleport destination='.fixed'}}

I will end up inside .fixed


{{/Teleport}}

```

```handlebars

{{#Teleport destination=targetElement}}

I will end up inside whatever is targetElement


{{/Teleport}}

```

```handlebars

{{#Teleport ''}}

I will end up inside document.body


{{/Teleport}}

```

## Run the tests

If you want to contribute and improve the package, make sure to run the tests.
Clone the package and run the following command:

```bash
$ TEST_WATCH=1 meteor test-packages ./ --driver-package meteortesting:mocha
```

## License

Teleport is released under the [MIT License](http://opensource.org/licenses/MIT).