GithubHelp home page GithubHelp logo

Comments (11)

NullVoxPopuli avatar NullVoxPopuli commented on June 11, 2024 2

Importing in css is fine, but more confusing to recommend, because in order to get the css to be part of your module graph, you need css imported into js.
That is, it's not clear if importing in to css is from special css that already participates in the module graph, or if from the legacy style system: which [the legacy system] is always global, and can't participate in route based (or any kind of) splitting ever

(Docs could always be sure to mention this, however)

from ember-power-select.

mkszepp avatar mkszepp commented on June 11, 2024 1

@NullVoxPopuli ember-basic-dropdown and ember-power-select are now V2 addon (both were released for now as beta v8.0.0-beta.0). The migration to v2 addon has bring also some braking changes see #1619 & cibernox/ember-basic-dropdown#728

The css is now not anymore auto-imported. It must be manually done like you have described.

CSS import example is present in documentation:

from ember-power-select.

johanrd avatar johanrd commented on June 11, 2024

I also stumbled upon the change in v2 when importing css in vanilla css contexts. FWIW, I found it possible to import the css directly into /assets/styles.css like this:

@import 'ember-power-select/vendor/ember-power-select.css';

(It may be a matter of personal taste, but I sometimes find it cleaner to import css directly in css, and not via js.).

from ember-power-select.

mkszepp avatar mkszepp commented on June 11, 2024

There are a lot of options to import the css in the app... but i think we should add only one way in documencation (which is already), because i think that is the recommended way.
Since the file is public everyone can add it like he want. We can block that only by creating a "-private" folder, but if somebody want to import from "-private" he has always the possibility.

Option 1 (recommended):

// app.js or other js file
import 'ember-power-select/styles';

Option 2:

/* assets/styles.css */
@import 'ember-power-select/vendor/ember-power-select.css';

Option 3:
removed

from ember-power-select.

NullVoxPopuli avatar NullVoxPopuli commented on June 11, 2024

Option 3 should be banned from historical records πŸ˜…

Option 2 in fine for tiny apps.

But only importing in js, or css-that-participates-in-the-module-graph, can you canditionally get the power-select css upon an await import(..) component/route/whatever.

but i think we should add only one way

This would be ideal, but (un)fortunately we don't have only one way.
Hopefully soon tho!

from ember-power-select.

mkszepp avatar mkszepp commented on June 11, 2024

okay thank you!
I have removed option 3 in my comment πŸ˜… (before somebody use that :D)...

If i have understand correctly, we should add option 2 also in docs with example from a route and describe, that there is also possible to use in component and controllers... right?

The blueprint adds always this lines in app.js like in your initial comment

from ember-power-select.

NullVoxPopuli avatar NullVoxPopuli commented on June 11, 2024

If i have understand correctly, we should add option 2 also in docs with example from a route and describe, that there is also possible to use in component and controllers... right?

yeah, exactly.

The blueprint adds always this lines in app.js like in your initial comment

yeah, it's the lazy documentation way.

And depending on your app's build config, you can use

@import 'ember-power-select/styles`

and have it participate in the module graph.

It's a weird balance between trying to document what's possible, and trying not to cover all cases possible.
I like to lean towards over-documenting this sort of stuff, because build behavior is super opaque to folks unfamiliar with how crazy JS build tooling is.

from ember-power-select.

mkszepp avatar mkszepp commented on June 11, 2024

@NullVoxPopuli @johanrd i have added the option in docs... would you like to review before we merge it (see #1627)?

Docs preview: https://deploy-preview-1627--rubber-tapper-eddies-44787.netlify.app/docs/installation

from ember-power-select.

johanrd avatar johanrd commented on June 11, 2024

oh, great. Looks good to me.

I learnt something new regarding the module-graph benefits of importing through js, thanks! Regarding the benefits – if i understand it correctly – importing directly to app.js, won't give any module loading benefits, right? – you would rather need to import 'ember-power-select/styles'; in all the actual components / controllers / routes that are using ember-power-select.

from ember-power-select.

NullVoxPopuli avatar NullVoxPopuli commented on June 11, 2024

Correct

@mkszepp looks good!

from ember-power-select.

mkszepp avatar mkszepp commented on June 11, 2024

Great! Many thanks for inputs... PR is merged and so i think, that we can also close this issue

from ember-power-select.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.