npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ember-cli-meta-options

v1.0.0

Published

Use meta tags to pass your Ember.js app options.

Downloads

63

Readme

Ember-cli-meta-options

This simple add-on will add an options object to your App instance to be used for passed in configuration from meta tags on the page where your app is instantiated.

Why is this useful?

By parsing meta tags with your app's modulePrefix as a prefix, you can make passed in settings available to app for your use.

This is can be handy if you want to use one app as the basis for a widget where all that varies is text and perhaps exportable values.

You can find background here:

http://discuss.emberjs.com/t/how-to-have-multiple-instances-of-an-app-in-same-window/6733

Example code to come, in the mean time you can email me if you have questions (wm -a t- waltermcginnis dot com).

Installation

ember install ember-cli-meta-options

You'll then need to config the addon by adding this to your config/environment.js (only add from BEGIN to END, everything is context about where to put it, mind the comma just before BEGIN):

  var ENV = {
    modulePrefix: 'poc2',
    ...
   APP: {
     ...
   },
   // BEGIN configuration for options initializer
   optionsConfig: {
     // leave blank to use all defaults
     // metaNamePrefix: modulePrefix
     // valueAttr: 'content'
     // parentPathIgnoreUpTo: 2
     // parentPathToIgnoreUpTo is index of number of parent parts in path to ignore
     // conventional parent path in meta tag name is 'modulePrefix/initializers/options/'
   }
   // END configuration for options initializer
}

Usage

Simply add meta tags with the name value pairs that you want to your index.html file or wherever your app is deployed following this convention:

<meta name="[your_app's modulePrefix]/initializers/options/your_setting_name" content="your_value">

E.g.

<meta name="example/initializers/options/appTitle" content="Example Ember App">

This would make an options object with the propery named appTitle with a value of "Example Ember App" available to use.

You can also group options by nested objects.

E.g.

<meta name="example/initializers/options/article/title" content="Example article">
<meta name="example/initializers/options/article/summary" content="Blah, blah, blah">

Would result in the options object having a nested object called article with two properties called title and summary.

{ article: { title: "Example article", summary: "Blah, blah, blah" } }

Tests

There are now acceptance tests that confirm the core features work.

I'm happy to accept pull requests for unit tests of the initializer code though.

Credits

Originally developed by Walter Mcginnis. Upgraded to Ember 3.5 by Jiří Prokop.

This ember-cli add-on was built as a part of widget work for http://askthem.io.

It's based on code from Ember Zone.

Thanks to the Ember.js, ember-cli, and Broccoli teams for excellent work.