Include only part of ember addon in ember app - ember.js

Currently I'm working on a project which uses Ember and requirejs. My plan is to migrate the project to ember-cli, but I'm facing some problems.
My app consists of multiple apps and one shared folder in which I put shared code of all other apps (like models, adapters, serializers, helpers, routes etc.). Not all of this code is used by every app, they only require what they need.
My plan is to create multiple ember apps of the apps mentioned above and move the shared code to an ember addon. Now I am wondering if it is possible to only include a part of this ember addon into the applications (only what they need). I did not find any relevant information in the docs for this use case.
Any ideas would be appreciated.

I ended up using the addon folder within my addon to share most of the files. This files can be imported from all apps and when building only the imported files are included into the final build file.

Related

Using test support code from an ember addon

I have several ember apps which use a common shared ember-cli addon. This addon has common code like models, navigation etc. I also want this addon to provide common test support code like test helpers, factories to the ember apps. However if I remove tests from .npmignore in the addon, then the test resources gets built with the ember app.
Is there a way to use the addon in an ember app, but strip the addon's tests folder on build? Or perhaps there is a better way of achieving this?
Common code can go to the addon's test-support folder. That folder would automatically get merged into the app's tests folder.
This is mentioned here - https://ember-cli.com/extending/#addon-project-structure

Why does Ember.js require a server?

I've downloaded Ember.js ver 1.13.13 for a test drive.
With other js frameworks, I am able to run from a file system. Does Ember require a server? I could not run directly from a file system. I did find some old tutorials that allows this. Is this a new thing?
You are using Ember-CLI which requires running ember serve in order to view your ember app. Ember-CLI uses conventions so that it knows where to locate the files that compose your ember app. As Ember-CLI locates your files, it knows how to combine them in a manner that ultimately results in the single JavaScript file that is executed in your browser. In theory you could use the globals style of development-which is the style reflected in the 'old tutorials' that you reference-and run the app directly without using any sort of "server." But, I don't recommend that. Learning Ember-CLI is useful as it is the preferred method of development moving forward. And, in my opinion, gives you a number of features that allow you to more quickly prototype apps. You can read more about that in the link I provided to the Ember-CLI website.

ember-cli project within Django application

Up till now I was using ember by including all required vendor files in Django static folders. With the rise of ember-cli more and more ember related files are not available in stand-alone version. They require using npm and/or ember-cli.
Ember-cli uses npm, and it creates and manages its own files, create all project files and manages loading them... so now how can I integrate than withing a Django application. Like:
I want to hook up an ember application on a given page in Django. ember-cli doesn't seems to cover such scenarios?
all vendor files (JS and other) must be served by Django / found by staticfiles finders. npm won't install to Django project staticfiles directory.
and it would be good to be able to collect files/make apps withing separate subfolders so that older apps won't break when newer app pulls newer vendor files etc.
So is that somewhat doable with ember-cli and Django? What is the best way to handle such projects?
You are going to need to set up a build and deployment process in order to deploy the assets built by Ember so that they can be served by your Django application.
I want to hook up an ember application on a given page in Django.
ember-cli doesn't seems to cover such scenarios?
You can most definitely have an Ember application live within a Django page. Set up your appplication outlet within the page served by Django.
all vendor files (JS and other) must be served by Django / found by
staticfiles finders. npm won't install to Django project staticfiles
directory.
Set up a process that copies the dependencies downloaded by npm to the static files
directory as part of your deployment.
and it would be good to be able to collect files/make apps withing
separate subfolders so that older apps won't break when newer app
pulls newer vendor files etc.
It would seem an equaly bad idea to have multiple copies of the same dependency floating around -- especially if a single user will navigate to multiple ember applications hosted on various pages of your Django app which rely on the same libraries. You will have to make a choice of whether to try to maintain the depencies for each of your Ember applications individually or to ugrade depencies across each of them at the same time. This will depend on your needs and how tightly coupled the functionality in each of your apps is.

Deploy Ember Application

I have created an ember application (prior to the arrival of Ember CLI) which follows a file hierarchy as given below:
Modules
Controllers
Views
Models
Routes
App.js
I would like to know that is there any way to deploy these files by compiling as a single javascript and html file, like now we are doing in ember cli. Since my application is using offline APP Cache, I terribly need this feature to avoid save numberous files and downloading it from cache manifest file.
After some research I have decided to update application with Ember CLI. This seems to be the best option to build and deploy Ember Application.

Multiple Ember Apps in one Yeoman Ember project

Is it possible have multiple apps that share UI/CSS/libs etc. in one yeoman ember project with one Gruntfile.js?
I have tried using the Yeoman ember generator, and it is wonderful for 1 app environment at a time.
But my situation is that I have multiple ember apps (that are required to be separate because of work oriented restrictions) that all use the same UI (LESS/CSS, bower_components).
So, instead of having to initiate 5 different build environments (Yeoman ember generators) that duplicate the same UI elements, I would love to be able to have them all in one build environment instead. I have tried building the taxonomy and tweaking the grunt tasks but it seems that the Ember compiling logic for the 'generator-ember' only looks at the index.html in the root.
Any info/insight is welcome.