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

Can/should this be used to import non-JS assets from node_modules, e.g. CSS / SASS? #66

Closed
jacobq opened this issue Jul 16, 2018 · 2 comments

Comments

@jacobq
Copy link
Contributor

jacobq commented Jul 16, 2018

For example, I am using materialize-css, and in addition to being able to import the JS into components I want to @import SASS assets in my styles. Thus far I've been accomplishing this by using something like this in my ember-cli-build.js:

const app = new EmberApp(defaults, {
  // ...
  sassOptions: {
    includePaths: [
      'node_modules/materialize-css/sass'
    ]
  }
  // ...
}

Should I keep doing this or does ember-auto-import do something in this space as well?

@ef4
Copy link
Collaborator

ef4 commented Jul 16, 2018

There are no conventions, so doing what you're doing is fine.

There are several different possible things people might mean when they think of importing CSS or SASS:

  1. Replacing app.import of CSS (or anything that is being transpiled into CSS), so that apps could say import "some-package/some.css" and that would cause it to automatically end up in vendor.css. That's a pretty small change and not hard to implement. I would like to add this.

  2. Dynamic import of CSS (meaning await import('some-package/some.css') would resolve once the given CSS is added to your document). This either already works or would be a small addition.

  3. Making @import 'some-pacakge' in your SCSS or CSS file automatically resolve to some-package from NPM and cause build-time inclusion. This is also something I would like to do, but it doesn't fit inside ember-auto-import. It's on my world-domination plan, but not until a later stage where the things ember-auto-import are doing have moved directly into ember-cli.

@jacobq
Copy link
Contributor Author

jacobq commented Jul 16, 2018

Thanks for the reply. I am most interested in the 3rd one, as it seems a lot more intuitive to me (at least for a new user) to try node_modules/some-package when doing @import 'some-package' in stylesheets rather than have to find the magic place to wire that up (though once you know it, it is kind-of nice to have it be so explicit).

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

No branches or pull requests

2 participants