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.
Related
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
I have a 'core' Ember application that needs to be able to be extended by 'child' Ember apps. In Ember 0.10, this was achieved by heavily modding grunt tasks, but Ember 2 appears to have a possible workflow for this built in.
A super high level summary of my current (and target) setup:
core-application ('core')
contains shared business logic across All apps + templates and components
plugins
shared templates and logic that can be reused across apps (but not needed by all)
application
is composed of elements from core-application, plugins, + any app specific code. a note that routes should be able to be 'pulled in' from 'core'
In the current Ember 0.10 app structure, this has worked by modifying grunt tasks to build the apps in a quick, fairly fool-proof way.
Now, in Ember 2, it appears that this sort of pathway for app development is provided by using addons and blueprints. I suspect my 'core' app should become a 'blueprint' and plugins could be either an 'addon' OR 'blueprint' based on what is required by them. I'm writing proof of concept code now, but I have the following questions:
what does the --blueprint flag for the ember addon command do? I see that it essentially generates an app structure, but I don't see any realy documentation regarding where to go from there. This appears to to be what I want to use for my 'core' app, but the documentation is lacking here.
If the above --blueprint flag isn't what I want for this kind of set up, is there a better approach I should be considering?
Any other info regarding the above that folk with greater Ember 2 + ember-cli experience than I have can share on this would be hugely helpful.
Thanks in advance for any all feedback.
I found my answer by digging around existing Ember community addons.
The ember admin project seems to outline the structure AND consumption of an Ember addon that essentially creates an Ember app complete with routes and overridable/extendable elements.
The Host application then 'mounts' the admin addon by importing the admin addon's routes to the host application's routes and BOOM things work as expected. I've been able to write POC code to prove this concept works for my needs.
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.
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.
I have a simple Ember-CLI addon which provides a few helper Mixins. This addon is meant to be consumed by a set of addons which all want to do user-interface things (react to size changes, field validation, etc.).
So in essence there is a three step chain:
Ember CLI Application consumes UI Ember Addon
UI Addon consumes Mixin Addon to gain access to a common features library
Mixin Addon provides a set of Mixins to consumers
If I put the Mixins implementation into the /app/mixins directory than the UI Addon can import these mixins with an import to ../mixins/[mixin-name]. That works but when I try and move back to the actual Ember App it can no longer resolve the mixins.
I guess that's not surprising really and what I want to be able to do instead is reference the mixins directly, like so: ui-mixin-library/mixins/[mixin-name]. Unfortunately the resolver is not able to resolve this.
In order to help achieve this goal I have put all the mixins into the /addon/mixins directory -- and as the Ember-CLI page suggests -- I import and then export these in the corresponding /app/mixins folder. Doesn't seem to help. Not sure if maybe I need to run these mixins through app.import?
For reference purposes, the Mixin Addon can be found here: addon on github