npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ember-tailwind-codemod

v0.5.2

Published

![Build and Deploy](https://github.com/rajasegar/ember-tailwind-codemod/workflows/CI/badge.svg) [![npm version](http://img.shields.io/npm/v/ember-tailwind-codemod.svg?style=flat)](https://npmjs.org/package/ember-tailwind-codemod "View this project on npm"

Downloads

13

Readme

ember-tailwind-codemod

Build and Deploy npm version Coverage Status

A Codemod to convert plain CSS class definitions into Tailwind utilities for your Ember Components

Installation

npm install --global ember-tailwind-codemod

Usage

To run the codemod, you would enter the following command in your terminal:

npx ember-tailwind-codemod  path/of/files --css=dist/assets

# or

yarn global add ember-tailwind-codemod
ember-tailwind-codemod  path/of/files --css=dist/assets

You have to pass the CSS build assets dir path to parse the CSS for conversion. It is mandatory

npx ember-tailwind-codemod app/templates --css=dist/assets/

You have to setup Tailwind CSS manually for your Ember project. This codemod will only do the conversion.

Things to to before running the command

Before running the codemod in your Ember project, please ensure you generate the CSS assets through your build. Since the codemod needs the final CSS to parse your class definitions and generate the Tailwind utilities.

Something like the below command will do:

ember build --environment=production

Logs

There are two log files that will be generated to assist you with Tailwind migration. They are

  • UNMAPPED_SELECTORS.txt => Contains the selectors in your CSS for which there is no conversion.
  • UNCHANGED_COMPONENTS.txt => Contains the list of component names for which the class attributes are not changed.

By looking at the above files, after running the codemods, you can manually complete the migration because the codemod won't be able to do 100% migration of your CSS and some manual intervention is required.

How it works?

  • First it constructs the Tailwind utilities from your CSS selectors and store it in a map.
  • Second, it will look into each of your hbs files for Components or ElementNodes with class attributes
  • Then, it will try to find the selector mapping from the map from class names.
  • Finally, if it have a mapping it will replace the class attribute values with Tailwind utilities.

Local Usage

node ./bin/cli.js path/of/files/ or/some**/*glob.js

Transforms

Contributing

Running tests

  • yarn test

Update Documentation

  • yarn update-docs

FAQs

Will the codemod automatically setup Tailwind for our projects?

NO, the codemod will only do the conversion to Tailwind utilities, you have to manually setup Tailwind for your Ember project. You can take a look at the following resources for the same:

  • https://github.com/embermap/ember-cli-tailwind
  • https://embermap.com/topics/using-functional-css-with-ember/getting-started-with-tailwind-css
  • https://dev.to/jamesbyrne/using-tailwindcss-with-ember-41el
  • https://www.mylittletechlife.com/setting-up-tailwindcss-with-ember-in-2020
  • https://balinterdi.com/blog/ember-tailwind-css-postcss-import/

Are there any caveats?

Yes, for the first cut, this codemod will only be able to support class selectors, element selectors and combinators, which means, other CSS selectors like pseudo-class selectors, pseudo-elements and attribute selectors, child selector, adjacent sibling and general sibling selectors are not supported yet. But it is definitely possible in the future and I am working on it. And I could really use some help with Pull Requests.

How do I know which things are not converted or omitted?

You can inspect the generated log files to check for the same. More info at logs