Giter Site home page Giter Site logo

ember-cli-responsive's Introduction

Ember-cli-responsive

Ember CLI addon for using ember-responsive

Build Status

This README outlines the details of collaborating on this Ember addon. All contributions welcome!

Usage

  • ember install ember-cli-responsive

Import ember-cli-responsive module into your app.js and add responsive break points as below.

import Ember from 'ember';
import Resolver from 'ember/resolver';
import loadInitializers from 'ember/load-initializers';
import config from './config/environment';
import 'ember-cli-responsive/responsive';

let App;

Ember.MODEL_FACTORY_INJECTIONS = true;

App = Ember.Application.extend({
  modulePrefix: config.modulePrefix,
  podModulePrefix: config.podModulePrefix,
  Resolver
});

App.responsive({
  media: {
    mobile:  '(max-width: 768px)',
    tablet:  '(min-width: 769px) and (max-width: 992px)',
    desktop: '(min-width: 993px) and (max-width: 1200px)',
    jumbo:   '(min-width: 1201px)'
  }
});

loadInitializers(App, config.modulePrefix);

export default App;

You can then query those breakpoints in your controllers, components, routes, and views:

  this.get('media.isMobile'); // => true

The same is true in templates:

  {{#if media.isDesktop}}
    Desktop view!
  {{/if}}

Polyfill with matchMedia

After running the above generator you can simply import via your project's ember-cli-build.js

//ember-cli-build.js
app.import('bower_components/matchMedia/matchMedia.js');

Installation

  • git clone this repository
  • npm install
  • bower install

Running

Running Tests

  • npm test

Building

  • ember build

For more information on using ember-cli, visit http://www.ember-cli.com/.

ember-cli-responsive's People

Contributors

avcengineering avatar ember-tomster avatar varoot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

ember-cli-responsive's Issues

Add matchMedia polyfill back in as optional dependency

Unfortunately, many people still need to support IE8 and IE9. I'd recommend adding the matchMedia polyfill back in as an optional dependency, or at least mention it in the docs to prevent confusion over why their app is breaking in browsers that don't support matchMedia.

Deprecation Warning

DEPRECATION: Addon files were detected in `........./node_modules/ember-cli-responsive/addon`, but no JavaScript preprocessors were found for `ember-cli-responsive`. Please make sure to add a preprocessor (most likely `ember-cli-babel`) to in `dependencies` (NOT `devDependencies`) in `ember-cli-responsive`'s `package.json`.

When running ember serve, I get the following deprecation warning.

Ember-cli-responsive and IE9

Under IE9, I get this error message: SCRIPT5007: Object expected.

It corresponds to this line :

App.responsive({ // ember-cli-responsive plugin conf
// ....

Force media type in testing?

Is there a way to force different media query in an automated test? I use ember-cli-responsive to render different layouts for each device and would like to have a way to test it (without opening a browser).

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.