JSPM

@runspired-forks/ember-maybe-in-element

2.0.4
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q39922F
  • License MIT

Ember AST transform for the in-element helper

Package Exports

  • @runspired-forks/ember-maybe-in-element
  • @runspired-forks/ember-maybe-in-element/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@runspired-forks/ember-maybe-in-element) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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.

Compatibility

  • Ember.js v3.16 or above
  • Ember CLI v2.13 or above
  • Node.js v10 or above

The code

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

becomes equivalent 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.

DockYard, Inc © 2017

@dockyard

Licensed under the MIT license