-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add app.import
to control legacy files, remove broccoli-bower.
#562
Conversation
changelog entry reminder from the changelog police |
can you add ember-data + ic-ajax like this? (as they are "optional") Interestingly now we can simply add ember.prod and ember.js based on ENV |
@stefanpenner - CHANGELOG and ember-data + ic-ajax are now in the Brocfile. |
Updated to eliminate |
|
||
this.import('vendor/jquery/jquery.js'); | ||
this.import('vendor/handlebars/handlebars.js'); | ||
this.import('vendor/ember/ember.js'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rjackson maybe could we allow here an easy way to specify my ember.js path? Besides of what @stefanpenner said of using ENV to decide if we use min or not, I would like to use canary and here the story is a little more complicated (unless it changed).
I'm updating an app to this Brocfile, and I have the following in my bower.
"ember": "http://builds.emberjs.com/canary/ember.js",
"ember-prod": "http://builds.emberjs.com/canary/ember.prod.js",
I'm doing something like
app.legacyFilesToAppend = without(app.legacyFilesToAppend, 'ember/ember.js');
if (app.env === 'production') {
app.import('ember-prod/index.js');
} else {
app.import('ember/index.js');
}
Which doesn't work, we require Ember to before ember-load-initializers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rjackson had to do this for now abuiles/facturas@bb9e6a4#diff-9a3a7fe04f7b4d48682fbfabba5b163dR10
this.import('vendor/handlebars/handlebars.js'); | ||
this.import({ | ||
development: 'vendor/ember/ember.js', | ||
production: 'vendor/ember/ember.prod.js' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated PR description with examples of new usage/API. This can serve as a basis for docs in the gh-pages branch. |
I like it |
(y) |
for reference, the gist of random ideas: https://gist.github.com/stefanpenner/3ce98d7554a463f3958f |
Will you import css/sass/scss this way as well? |
@tonywok - No, I do not think so. You would follow similar steps to the |
Now that I think about it, maybe it does need to be the same (or a similar) API. |
@rjackson If we imported the css assets in a similar way, I think we could get a hold of them in the Pulling down your branch and playing around :) |
@tonywok exactly |
@stefanpenner Although I think there may still be a problem with the What are your thoughts on importing it along with some metadata - so we know what trees to merge? /cc @rjackson Or is there some broccoli-foo I don't know about yet? |
I think this handles the basic JS scenario well, I want to get the styles straightened out too. I need some examples that I can use for testing the CSS solution. Just a handful of common libraries and/or a |
@rjackson i'll through up an example i've been working on shortly |
also fixes: #233 |
This looks great, @rjackson! So much cleaner. There are a couple of issues with hardcoded values, on lines 91, 142, and 201. Those should reference the
Also, I suggest adding a |
@JPBetley - Thanks for reviewing: I fixed two of the references (lines 91 and 201), but the third (142) has to do with the location to use as the root when searching for a RE: public folder, I am planning on another pass through (after this lands) to make the |
Updated to handle styles better. |
Updated with examples of both dynamic and static styles. |
Lets loader + wrapInEval also be configurable. We plan soon to make loader configurable via the underlying filter. Please note, the current setup still does not allow this.
Defaults only allows single depth merges.
lets get a PR ready for the website aswell, i'll try to doit tonight after which hopefully we can cut the release. |
Add `app.import` to control legacy files, remove broccoli-bower.
Summary
This PR removes
broccoli-bower
since thebower.json
spec doesn't provide enough information on exactly what should and shouldn't be imported, and it adds a newEmberApp.prototype.import
method.EmberApp.prototype.import
is used both internally and in your Brocfile to manage your dependencies.Usage
In your
Brocfile.js
specify a dependency before callingapp.toTree()
. The following example scenarios should illustrate how this works.Javascript Assets
Standard Non-AMD Asset
Provide the asset path as the first and only argument:
Standard AMD Asset
Provide the asset path as the first argument, and the list of modules and exports as the second:
Environment Specific Assets
If you need to use different assets in different environments, specify an object as the first parameter. That objects keys should be the environment name, and the values should be the asset to use in that environment.
Customizing a built-in Asset
This is somewhat non-standard, but suppose that you have different versions of Ember specified (using the canary builds for example). You would simply manipulate the vendor tree that is passed in to the
EmberApp
constructor:Styles
Static CSS
Provide the asset path as the first argument:
All style assets added this way will be concatenated and output as
/assets/vendor.css
.Dynamic Styles (SCSS, LESS, etc)
The vendor trees that are provided upon instantiation are available to your dynamic style files. Take the following example (in
app/styles/app.scss
):