Giter Club home page Giter Club logo

ember-maybe-in-element's Introduction

ember-maybe-in-element

This addon exposes the construct {{#maybe-in-element el renderInPlace insertBefore=null}}The block{{/maybe-in-element}} to the contained block somewhere else in the page.

Despite its syntax, it's not implemented as a component but as an AST transform.

Essentially, it statically transforms:

{{#maybe-in-element el renderInPlace insertBefore=null}}The block{{/maybe-in-element}}

to:

{{#if renderInPlace}}The block{{else}}{{#in-element el insertBefore=null}}The block{{/-in-element}}{{/if}}

Motivation

Although nothing prevents you from achieving the same thing by manually typing the expanded handlebars code yourself, having two identical blocks is an invitation to forget to update one and introduce unwanted differences between both. Also, less typing!

Installation

The addon uses ember-in-element-polyfill, so its support matrix is the same (2.10+ at the time of this writing)

  • Run ember install ember-maybe-in-element

Be aware that if you intend to use this addon from within another addon, you must move it from devDependencies to dependencies in your package.json.

Legal

DockYard, Inc © 2017

@dockyard

Licensed under the MIT license

ember-maybe-in-element's People

Contributors

cibernox avatar dependabot[bot] avatar ember-tomster avatar serabe avatar simonihmig avatar snewcomer avatar xiphiasuvella avatar

Watchers

 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.