Skip to content
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

Fix SASS compilation issues #8013

Merged
merged 1 commit into from
Sep 5, 2018
Merged

Fix SASS compilation issues #8013

merged 1 commit into from
Sep 5, 2018

Conversation

twokul
Copy link
Contributor

@twokul twokul commented Sep 5, 2018

There are several ways add-on can add a style to the application:

  • create app/styles folder
  • create addon/styles folder
  • return a tree from treeForStyles hook

Previously, some add-ons (when using treeForStyles hook) would return
content under app/styles. That used to work before packager changes.

Because there's no contract (interface) that Ember CLI provides when you return
a tree from treeForStyles hook, packager treats it as an opaque tree
and moves its contents later on the "right" place. It unfortunately
creates scenarios as such:

the-best-app-ever/
  styles/
    app/
      styles/

where nested app/styles is a tree from an add-on.

While I believe add-ons should return content under the "root" of the
tree, we do need to support current behaviour w/o breaking anything.

Useful links:

There are several ways add-on can add a style to the application:

+ create `app/styles` folder
+ create `addon/styles` folder
+ return a tree from `treeForStyles` hook

Previously, some add-ons (when using `treeForStyles` hook) would return
content under `app/styles`. That used to work before packager changes.

Because there's no contract (interface) that Ember CLI provides when you return
a tree from `treeForStyles` hook, packager treats it as an opaque tree
and moves its contents later on the "right" place. It unfortunately
creates scenarios as such:

```
the-best-app-ever/
  styles/
    app/
      styles/
```

where nested `app/styles` is a tree from an add-on.

While I believe add-ons should return content under the "root" of the
tree, we do need to support current behaviour w/o breaking anything.

Useful links:

+ `app/styles` folder in
[`ember-basic-dropdown`](https://github.com/cibernox/ember-basic-dropdown/tree/v1.0.3/app/styles)
+ `treeForStyles` hook in
[`ember-cli-tailwind`](https://github.com/embermap/ember-cli-tailwind/blob/v0.6.1/index.js#L67)
+ `treeForStyles` hook in
[`ember-bootstrap`](https://github.com/kaliber5/ember-bootstrap/blob/v0.11.3/index.js#L54)
let addons = this.addonTreesFor('styles');

let flatten = addons.map(tree =>
new Funnel(tree, {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add comments in here about stuff to deprecate as people are doing things we don't want?

@rwjblue rwjblue merged commit 5a49bc5 into ember-cli:beta Sep 5, 2018
@rwjblue
Copy link
Member

rwjblue commented Sep 5, 2018

Merging (so we can get the release out), @twokul would you mind following up with the comments that @kellyselden mentioned?

@twokul twokul deleted the tree-fix branch September 5, 2018 18:11
@twokul
Copy link
Contributor Author

twokul commented Sep 5, 2018

@rwjblue absolutely

@kanongil
Copy link
Contributor

kanongil commented Sep 6, 2018

It still doesn't include addon styles that are imported from the app/styles dir in 3.4.1:

app.import("app/styles/style.css")

Note: It works if I move it to the vendor dir.

@Turbo87
Copy link
Member

Turbo87 commented Sep 6, 2018

@kanongil I don't think app.import() was ever meant to be used with the app folder in general.

@kanongil
Copy link
Contributor

kanongil commented Sep 6, 2018

Yes, I realise that (and I have moved my styles), but it's not documented that way, and it's done in the wild.

@Turbo87
Copy link
Member

Turbo87 commented Sep 6, 2018

AFAIK app.import() only supports vendor, bower_components and node_modules. PRs to the documentation are always welcome 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants