All Projects → NativeScript → tailwind

NativeScript / tailwind

Licence: other
Makes using TailwindCSS in NativeScript a whole lot easier!

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to tailwind

hugo-starter-tailwind-basic
A basic and simple to set up Hugo with TailwindCSS starter project.
Stars: ✭ 80 (-37.5%)
Mutual labels:  postcss, tailwind
stencil-tailwind-plugin
Plugin for using tailwindcss with StencilJS
Stars: ✭ 17 (-86.72%)
Mutual labels:  postcss, tailwind
eleventy solo starter njk
Further development suspended as of 2021-09-11. Please refer instead to https://www.11ty.dev/docs/starter/ for a wide selection of other Eleventy starter sets.
Stars: ✭ 22 (-82.81%)
Mutual labels:  postcss, tailwind
tailwindcss-postcss-browsersync-boilerplate
Tailwind CSS + PostCSS + BrowserSync boilerplate
Stars: ✭ 28 (-78.12%)
Mutual labels:  postcss, tailwind
Awesome Tailwindcss
😎 Awesome things related to Tailwind CSS
Stars: ✭ 7,791 (+5986.72%)
Mutual labels:  postcss, tailwind
Css Declaration Sorter
Sort CSS declarations fast and automatically in a certain order.
Stars: ✭ 188 (+46.88%)
Mutual labels:  postcss
Modular Css
A streamlined reinterpretation of CSS Modules via CLI, API, Browserify, Rollup, Webpack, or PostCSS
Stars: ✭ 234 (+82.81%)
Mutual labels:  postcss
Xity Starter
A blog-ready 11ty starter based on PostCSS, with RSS feed and Native Elements!
Stars: ✭ 184 (+43.75%)
Mutual labels:  postcss
Vanilla Back To Top
Simple and smooth Back To Top button
Stars: ✭ 179 (+39.84%)
Mutual labels:  postcss
tailwind-components
Collection of components found on the internet
Stars: ✭ 1,326 (+935.94%)
Mutual labels:  tailwind
Prejss
Get the power of PostCSS with plugins in your JSS styles. 🎨 Just put CSS into JS and get it as JSS object.
Stars: ✭ 238 (+85.94%)
Mutual labels:  postcss
Kit
ReactQL starter kit (use the CLI)
Stars: ✭ 232 (+81.25%)
Mutual labels:  postcss
Jamstack Web Starter
Static website workflow utilising Eleventy, Tailwind CSS, Webpack and PostCSS.
Stars: ✭ 198 (+54.69%)
Mutual labels:  postcss
Rfs
✩ Automates responsive resizing ✩
Stars: ✭ 2,789 (+2078.91%)
Mutual labels:  postcss
Polymer Skeleton
💀 Skeleton for Polymer 3 app with Webpack, PostCSS and Service Workers ready.
Stars: ✭ 185 (+44.53%)
Mutual labels:  postcss
Reset Css
An unmodified* copy of Eric Meyer's CSS reset. PostCSS, webpack, Sass, and Less friendly.
Stars: ✭ 244 (+90.63%)
Mutual labels:  postcss
Stylefmt
stylefmt is a tool that automatically formats stylesheets.
Stars: ✭ 2,123 (+1558.59%)
Mutual labels:  postcss
Next Starter Tailwind
Next.js starter styled with Tailwind CSS
Stars: ✭ 225 (+75.78%)
Mutual labels:  postcss
Core
Native HTML Elements with CSS superpowers. 🕶
Stars: ✭ 237 (+85.16%)
Mutual labels:  postcss
Svelte Boilerplate
Svelte application boilerplate with Webpack, Babel, PostCSS, Sass, Fetch, Jest, .Env, EsLint.
Stars: ✭ 216 (+68.75%)
Mutual labels:  postcss

@nativescript/tailwind

Warning: ⚠️ @nativescript/[email protected] is required for colors to work properly You may see wrong colors on older core versions, because Tailwind CSS v3 uses the RGB/A color notation, which has been implemented for 8.2.0 and prior versions don't support it.

Makes using Tailwind CSS in NativeScript a whole lot easier!

<label
  text="Tailwind CSS is awesome!"
  class="px-2 py-1 text-center text-blue-600 bg-blue-200 rounded-full"
/>

Tailwind CSS is awesome!

Usage

Note: This guide assumes you are using @nativescript/[email protected] as some configuration is done automatically. If you have not upgraded yet, please read the docs below for usage with older @nativescript/webpack versions.

Install @nativescript/tailwind and tailwindcss

npm install --save @nativescript/tailwind tailwindcss

Generate a tailwind.config.js with

npx tailwindcss init

Adjust content, darkMode, corePlugins plus any other settings you need, here are the values we recommend:

// tailwind.config.js
const plugin = require('tailwindcss/plugin');

/** @type {import('tailwindcss').Config} */
module.exports = {
  content: [
    './app/**/*.{css,xml,html,vue,svelte,ts,tsx}'
  ],
  // use the .ns-dark class to control dark mode (applied by NativeScript) - since 'media' (default) is not supported.
  darkMode: ['class', '.ns-dark'],
  theme: {
    extend: {},
  },
  plugins: [
    /**
     * A simple inline plugin that adds the ios: and android: variants
     * 
     * Example usage: 
     *
     *   <Label class="android:text-red-500 ios:text-blue-500" />
     *
     */
    plugin(function ({ addVariant }) {
      addVariant('android', '.ns-android &');
      addVariant('ios', '.ns-ios &');
    }),
  ],
  corePlugins: {
    preflight: false // disables browser-specific resets
  }
}

Change your app.css or app.scss to include the tailwind utilities

@tailwind base;
@tailwind components;
@tailwind utilities;

Start using tailwind in your app.

Using a custom PostCSS config

In case you need to customize the postcss configuration, you can create a postcss.config.js (other formats are supported, see https://github.com/webpack-contrib/postcss-loader#config-files) file and add any customizations, for example:

// postcss.config.js

module.exports = {
  plugins: [
    ["tailwindcss", { config: "./tailwind.config.custom.js" }],
    "@nativescript/tailwind",
  ],
};

Note: if you want to apply customizations to tailwindcss or @nativescript/tailwind, you will need to disable autoloading:

ns config set tailwind.autoload false

This is required only if you make changes to either of the 2 plugins - because by default postcss-loader processes the config file first, and then the postcssOptions passed to it. With autoloading enabled, any customizations will be overwritten due to the loading order. Setting tailwind.autoload to false just disables the internal loading of these plugins, and requires you to manually add them to your postcss config in the above order.

Usage with older @nativescript/webpack versions

This usage is considered legacy and will not be supported - however we are documenting it here in case your project is still using older @nativescript/webpack.

See instructions
npm install --save-dev @nativescript/tailwind tailwindcss postcss postcss-loader

Create postcss.config.js with the following:

module.exports = {
  plugins: [
      require('tailwindcss'),
      require('nativescript-tailwind')
  ]
}

Generate a tailwind.config.js with

npx tailwindcss init

Adjust content, darkMode, corePlugins plus any other settings you need, here are the values we recommend:

// tailwind.config.js

module.exports = {
  content: [
    './app/**/*.{css,xml,html,vue,svelte,ts,tsx}'
  ],
  // use .dark to toggle dark mode - since 'media' (default) does not work in NativeScript
  darkMode: 'class',
  theme: {
    extend: {},
  },
  plugins: [],
  corePlugins: {
    preflight: false // disables browser-specific resets
  }
}

Change your app.css or app.scss to include the tailwind utilities

@tailwind base;
@tailwind components;
@tailwind utilities;

Update webpack.config.js to use PostCSS

Find the section of the config that defines the rules/loaders for different file types. To quickly find this block - search for rules: [.

For every css/scss block, append the postcss-loader to the list of loaders, for example:

{
  test: /[\/|\\]app\.css$/,
  use: [
    'nativescript-dev-webpack/style-hot-loader',
    {
      loader: "nativescript-dev-webpack/css2json-loader",
      options: { useForImports: true }
    },
+   'postcss-loader',
  ],
}

Make sure you append postcss-loader to all css/scss rules in the config.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].