A starter template for building Lynx applications with Tailwind CSS integration. This template provides a solid foundation for creating beautiful, responsive mobile applications using the power of Tailwind's utility-first CSS framework.
https://github.com/lynx-family/lynx/issues/356
- Clone this repository or use it as a github template:
# Clone the repository
git clone https://github.com/vkuprin/lynx-tailwind-starter.git
cd lynx-tailwind-starter
- Install the dependencies:
# Using yarn
yarn install
Start the development server:
# Using yarn berry
yarn dev
Scan the QR code displayed in your terminal with the LynxExplorer App on your mobile device to see the application in action.
This template comes with Tailwind CSS pre-configured and ready to use. Here's how it's set up:
- tailwind.config.js: Contains the Tailwind configuration with the Lynx preset
- postcss.config.js: Configures PostCSS to process Tailwind directives
- src/tailwind.css: Contains the Tailwind directives and custom styles
You can use Tailwind utility classes directly in your components:
<view className="flex flex-col items-center justify-center p-4 bg-blue-500 rounded-lg">
<text className="text-white text-xl font-bold">Hello Tailwind!</text>
</view>
If you want to add Tailwind CSS to an existing Lynx project, follow these steps:
- Install the required dependencies:
npm install tailwindcss autoprefixer postcss postcss-loader @lynx-js/tailwind-preset-canary
- Create a
tailwind.config.js
file:
/** @type {import('tailwindcss').Config} */
export default {
content: ['./src/**/*.{js,jsx,ts,tsx}'],
presets: [require('@lynx-js/tailwind-preset-canary')],
theme: {
extend: {},
},
plugins: [],
};
- Create a
postcss.config.js
file:
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
- Create a
src/tailwind.css
file with the Tailwind directives:
@tailwind base;
@tailwind components;
@tailwind utilities;
/* Add your custom styles here */
- Import the CSS file in your entry point (e.g.,
src/index.tsx
):
import './tailwind.css';
- Start using Tailwind classes in your components!
MIT