Install Preline UI with Ember.js using Tailwind CSS
Install Preline UI with Tailwind CSS in Ember.js projects, including JavaScript plugin setup, route rescans, element modifiers, and optional dependencies.
Ember.js quick setup
If Tailwind CSS is not set up yet, start with the official Ember.js + Tailwind CSS guide first.
-
Install Preline UI
Install
prelinewith your preferred package manager.Terminalnpm install prelinePreline UI uses the Tailwind CSS Forms plugin across form components. Install it if you have not already:
npm install -D @tailwindcss/forms -
Import Preline CSS and source files
Import
variants.cssintoapp/styles/app.cssafter thetailwindcssimport, then add the@sourceentry for Preline UI JavaScript.app/styles/app.css@import "tailwindcss"; /* Preline UI */ @import "../../node_modules/preline/variants.css"; @source "../../node_modules/preline/dist/*.js"; /* Plugins */ /* @plugin "@tailwindcss/forms"; */ /* Preline Themes */ @import "./themes/theme.css";See the Theme docs to learn more about Preline Themes.
-
Add Preline UI to the app entry
Import Preline UI in your application entry file,
app/app.js.app/app.jsimport 'preline' -
Load assets in the root template
With Ember's entry points configured, render the generated assets in your application's root template.
Specific guide
Continue with a focused guide for wiring Preline UI JavaScript plugins into this framework.
Optional Preline UI styles
Preline UI ships with a small set of opinionated base styles. If you want them in your project, add them to your CSS file. These defaults used to come bundled with Tailwind CSS v3, so they are still available as an optional layer in Preline UI.
/* Adds pointer cursor to buttons */
@layer base {
button:not(:disabled),
[role="button"]:not(:disabled) {
cursor: pointer;
}
}
/* Defaults hover styles on all devices */
@custom-variant hover (&:hover);