lukejacksonn / lukejacksonn/oceanwind

add directive grouping

Open
#41 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
264
Forks
11
PR merge metrics
No merged PRs in 30d

Description

oceanwind has introduced the awesome idea of variant grouping (sm:(...) hover:(...)).

In beamwind we've added directive grouping as well.

Directives with the same prefix can be grouped using parenthesis. Beamwind will expand the nested directives; applying the prefix to each directive in the group before translation. For example:

ow`text(center bold gray-500)`)
// => text-center text-bold text-gray-500

ow`divide(y-2 blue-500 opacity(75 md:50))`
// => divide-y-2 divide-blue-500 divide-opacity-75 md:divide-opacity-50

ow`w(1/2 sm:1/3 lg:1/6) p-sm`
// => w-1/2 sm:w-1/3 lg:w-1/6 p-sm

Some directives like ring need to be applied as is. For that case you can use the special & directive which is replaced with the current prefix:

ow`ring(& ping-700 offset(4 ping-200))`)
// => ring ring-ping-700 ring-offset-4 ring-offset-on-ping-200

I think it would be good if both libraries would support the same string syntax. I try to tackle this on the weekend. But as oceanwind has a different parsing approach it may take some time. I'll report my findings ...

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating oceanwind's parsing and translation entry points, since the issue says its parsing approach differs from beamwind. Implement the demonstrated parenthesized directive groups, including nested groups, responsive prefixes, and the special & prefix, then verify the examples expand to the shown directives.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, tailwindcss
Domain
frontend, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.