问题
New user to 3rd party bootstrap templates for Ember and need help.
I purchased the INSPINIA admin template from www.wrapbootstrap.com. The download comes with multiple pre-created projects with INSPINIA built in (e.g., Angular, Rails, etc.) but not for Ember. I reached out to the creator to see if they could include a project for Ember and they said no.
So, I am curious, does anyone know how to add INSPINIA to an Ember web application? Is it as simple as ember install bootstrap
and then copy the *.css file? Note: the INSPINIA template comes with way more files than just a *.css, and I am using ASP.NET CORE 2.2 for the web API.
Any help is appreciated.
回答1:
When I did the same thing a few years ago, I bought the theme just for the themed css. I used their less
and integrated that into my existing ember
build. Nowadays I'd use the scss
but it's unimportant.
What is important is understanding that bootstrap js components will not simply work in the context of your ember
application. If you want callbacks, events, binding, etc to exist in the context of ember
(ie within ember
's runloop and lifecycle), you will need to wrap each individual component. Luckily, ember-boostrap does exactly that for you. This addon provides the easiest way for you to pull in your bootstrap
scss. This addon also does not use bootstrap's js
, but rather is a full implementation of the bootstrap component's in a way that is ember-aware.
ember-bootstrap deliberately excludes bootstrap.js because the jQuery and Ember ways of control flow and animation sometimes don't play well together, causing unpredictable results. This is the main motivation behind ember-bootstrap. It is possible to import bootstrap.js from bower_components or the vendor folder. This is NOT recommended or supported, and you will be on your own. You have been warned!
Once you've gotten the scss
preprocessing properly set up in your ember-cli-build.js
file, you should be able to use their markup more or less directly. You will need to have some understanding, though, of when you're encountering bootstrap markup (stuff with data classes that will be handled by bootstrap's js). In moments like that, you simply use ember-bootstrap
components instead
来源:https://stackoverflow.com/questions/56102043/how-to-add-inspinia-bootstrap-to-ember-application