Giter VIP home page Giter VIP logo

rajmohan6268 / ngx-tailwind Goto Github PK

View Code? Open in Web Editor NEW

This project forked from notiz-dev/ngx-tailwind

0.0 0.0 0.0 2.03 MB

💨 Simple Angular schematic that initializes Tailwind CSS in your project and adds a custom webpack config to your build process.

Home Page: https://notiz.dev/blog/angular-10-with-tailwindcss#use-tailwind-css-utility-classes

License: MIT License

JavaScript 4.72% TypeScript 93.29% HTML 1.25% SCSS 0.73%

ngx-tailwind's Introduction

Tailwind CSS Schematics

npm version Schematics CI

Simple Angular schematic initializing Tailwind CSS in your project. Angular v11.2 includes native support for Tailwind CSS.

For all versions before Angular v11.2 a custom webpack config is added to your build process.

Installation

Run

ng add ngx-tailwind

# or

ng add ngx-tailwind --project <MY_PROJECT>

Example output

The package ngx-tailwind@dev will be installed and executed.
Would you like to proceed? Yes
✔ Package successfully installed.
? Which stylesheet format are you using? SCSS [ https://sass-lang.com/documentation/syntax#scss ]
? Which @tailwindcss plugins do you want to install? typography
CREATE tailwind.config.js (236 bytes)
UPDATE package.json (1095 bytes)
UPDATE src/styles.scss (177 bytes)
✔ Packages installed successfully.

Migrate from Tailwind CSS v1 to v2

To upgrade you project from Tailwind CSS v1.x to v2.0 run the following install command

npm i -D tailwindcss@latest autoprefixer@latest postcss@latest postcss-import@latest postcss-loader@latest

# using scss
npm i -D postcss-scss@latest

Read the full Upgrade Guide to update your custom tailwind.config.js (e.g. your color palette) and replace removed classes from your template (e.g. shadow-outline and shadow-xs).

Additional options

You can pass additional flags to customize the schematic. For example, if you want to install a different version for Tailwind use --tailwindVersion flag:

ng add ngx-tailwind --tailwindVersion 1.9.5

All available flags:

Flag  Description Type  Default
 autoprefixerVersion The autoprefixer version to be installed. string ^10.2.4
 cssFormat The file extension or preprocessor to use for style files. css |  scss css
 ngxBuildPlusVersion The ngx-build-plus version to be installed. string ^11.0.0
 project The project to initialize with Tailwind CSS. string First Angular project
 postcssVersion The postcss version to be installed. string ^8.2.6
 postcssImportVersion The postcss-import version to be installed. string ^14.0.0
 postcssLoaderVersion The postcss-loader version to be installed. string ^4.2.0
 postcssScssVersion The postcss-scss version to be installed. string ^3.0.4
 skipTailwindInit Skip initializing Tailwind. boolean false
 tailwindVersion The Tailwind version to be installed. string ^2.0.3
 disableCrossPlatform Set the build:prod script to be only UNIX compatible. boolean false
 crossEnvVersion The cross-env version to be installed. string ^7.0.3
 tailwindPlugins @tailwindcss plugins installed and added to tailwind.config.js string[] [aspect-ratio, forms, line-clamp, typography]

Advanced usage

ng add ngx-tailwind --cssFormat scss --tailwindVersion 2.0.0 --ngxBuildPlusVersion 10.1.1 --postcssVersion 8.0.0 --postcssImportVersion 13.0.0 --postcssLoaderVersion 4.0.4 --postcssScssVersion 3.0.4

Want to integrate Tailwind CSS in version 1.x.x? No problem:

ng add ngx-tailwind --tailwindVersion 1.9.6 --ngxBuildPlusVersion 10.1.1 --postcssVersion 7.0.35 --postcssImportVersion 12.0.1 --postcssLoaderVersion 4.0.4 --postcssScssVersion 3.0.4

By default, cross-env is added to the build:prod script to be able to set NODE_ENV=prod cross-platform. If you want to override the default behavior, you can set the flag --disableCrossPlatform:

ng add ngx-tailwind --disableCrossPlatform

Developing

Install @angular-devkit/schematics-cli to be able to use schematics command

npm i -g @angular-devkit/schematics-cli

Now build the schematics and run the schematic.

npm run build
# or
npm run build:watch

# dry-run in angular-workspace
npm run start:dev

# execute schematics in angular-workspace
npm run start

ngx-tailwind's People

Contributors

marcjulian avatar garygrossgarten avatar fcruzel avatar

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.