GithubHelp home page GithubHelp logo

gus-bn / ember-preloader Goto Github PK

View Code? Open in Web Editor NEW

This project forked from billyraypreachersson/ember-preloader

0.0 0.0 0.0 130 KB

A small preloader for Ember.js

License: MIT License

JavaScript 83.63% CSS 0.41% HTML 15.96%

ember-preloader's Introduction

ember-preloader

You put your preloader in, you take your preloader out, You put your preloader in, and you shake it all about...

This addon allows you to render files directly in to the index.html on the initial build, then removes them from the DOM once your app has loaded. Useful for adding a preloading screen before the initial app is downloaded.

Install

ember install ember-preloader

Usage

The addon leverages the contentFor helper. In your app's ember-cli-build.js define your options hash, either using the existing contentFor hooks or your own:

var app = new EmberApp(defaults, {
  preloader: {
    head: 'preload.css',
    body: 'preload.html'
    'custom-hook': 'preload.js',
    'custom-hook2': 'preload2.js'
  }
});

If you've used custom hooks, add them to your index.html file:

{{content-for 'custom-hook'}}
{{content-for 'custom-hook2'}}

Finally, import the mixin into your application route:

import PreloaderMixin from 'ember-preloader/mixins/preloader';
export default Route.extend(PreloaderMixin, {});

Example

ember-cli-build.js:

var app = new EmberApp(defaults, {
  preloader: {
    head: 'preload.css',
    body: 'preload.html',
    'body-footer': 'preload.js',
  }
});

Output:

<style data-preloader>
  ... preload.css content ...
</style>

...

<div data-preloader>
  ... preload.html content ...
</div>

...

<script data-preloader>
  ... preload.js content ... 
</script>

Linting

  • npm run lint:hbs
  • npm run lint:js
  • npm run lint:js -- --fix

Running tests

  • ember test – Runs the test suite on the current Ember version
  • ember test --server – Runs the test suite in "watch mode"
  • ember try:each – Runs the test suite against multiple Ember versions

Running the dummy application

ember-preloader's People

Contributors

ember-tomster 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.