Skip to content

Commit

Permalink
Add @tailwindcss/browser package (#15558)
Browse files Browse the repository at this point in the history
Co-authored-by: Philipp Spiess <hello@philippspiess.com>
Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
  • Loading branch information
3 people authored Jan 7, 2025
1 parent d4f693f commit dcf116b
Show file tree
Hide file tree
Showing 14 changed files with 930 additions and 17 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Add `@tailwindcss/browser` package to run Tailwind CSS in the browser ([#15558](https://github.com/tailwindlabs/tailwindcss/pull/15558))

### Fixed

- Use the correct property value for `place-content-between`, `place-content-around`, and `place-content-evenly` utilities ([#15440](https://github.com/tailwindlabs/tailwindcss/pull/15440))
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"dev": "turbo dev --filter=!./playgrounds/*",
"test": "cargo test && vitest run --hideSkippedTests",
"test:integrations": "vitest --root=./integrations",
"test:ui": "pnpm run --filter=tailwindcss test:ui",
"test:ui": "pnpm run --filter=tailwindcss test:ui && pnpm run --filter=@tailwindcss/browser test:ui",
"tdd": "vitest --hideSkippedTests",
"bench": "vitest bench",
"version-packages": "node ./scripts/version-packages.mjs",
Expand Down
40 changes: 40 additions & 0 deletions packages/@tailwindcss-browser/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<p align="center">
<a href="https://tailwindcss.com" target="_blank">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/tailwindlabs/tailwindcss/HEAD/.github/logo-dark.svg">
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/tailwindlabs/tailwindcss/HEAD/.github/logo-light.svg">
<img alt="Tailwind CSS" src="https://raw.githubusercontent.com/tailwindlabs/tailwindcss/HEAD/.github/logo-light.svg" width="350" height="70" style="max-width: 100%;">
</picture>
</a>
</p>

<p align="center">
A utility-first CSS framework for rapidly building custom user interfaces.
</p>

<p align="center">
<a href="https://github.com/tailwindlabs/tailwindcss/actions"><img src="https://img.shields.io/github/actions/workflow/status/tailwindlabs/tailwindcss/ci.yml?branch=next" alt="Build Status"></a>
<a href="https://www.npmjs.com/package/tailwindcss"><img src="https://img.shields.io/npm/dt/tailwindcss.svg" alt="Total Downloads"></a>
<a href="https://github.com/tailwindcss/tailwindcss/releases"><img src="https://img.shields.io/npm/v/tailwindcss.svg" alt="Latest Release"></a>
<a href="https://github.com/tailwindcss/tailwindcss/blob/master/LICENSE"><img src="https://img.shields.io/npm/l/tailwindcss.svg" alt="License"></a>
</p>

---

## Documentation

For full documentation, visit [tailwindcss.com](https://tailwindcss.com).

## Community

For help, discussion about best practices, or any other conversation that would benefit from being searchable:

[Discuss Tailwind CSS on GitHub](https://github.com/tailwindcss/tailwindcss/discussions)

For chatting with others using the framework:

[Join the Tailwind CSS Discord Server](https://discord.gg/7NF8GNe)

## Contributing

If you're interested in contributing to Tailwind CSS, please read our [contributing docs](https://github.com/tailwindcss/tailwindcss/blob/next/.github/CONTRIBUTING.md) **before submitting a pull request**.
35 changes: 35 additions & 0 deletions packages/@tailwindcss-browser/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "@tailwindcss/browser",
"version": "4.0.0-beta.8",
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/tailwindlabs/tailwindcss.git",
"directory": "packages/@tailwindcss-browser"
},
"bugs": "https://github.com/tailwindlabs/tailwindcss/issues",
"homepage": "https://tailwindcss.com",
"scripts": {
"lint": "tsc --noEmit",
"build": "tsup-node",
"dev": "pnpm run build -- --watch",
"test:ui": "playwright test"
},
"exports": {
".": "./dist/index.mjs",
"./package.json": "./package.json"
},
"files": [
"dist"
],
"publishConfig": {
"provenance": true,
"access": "public"
},
"devDependencies": {
"h3": "^1.13.0",
"listhen": "^1.9.0",
"tailwindcss": "workspace:*"
}
}
66 changes: 66 additions & 0 deletions packages/@tailwindcss-browser/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { defineConfig, devices } from '@playwright/test'

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './tests',
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
},

/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},
{
name: 'firefox',
use: {
...devices['Desktop Firefox'],
// https://playwright.dev/docs/test-use-options#more-browser-and-context-options
launchOptions: {
// https://playwright.dev/docs/api/class-browsertype#browser-type-launch-option-firefox-user-prefs
firefoxUserPrefs: {
// By default, headless Firefox runs as though no pointers
// capabilities are available.
// https://github.com/microsoft/playwright/issues/7769#issuecomment-966098074
//
// This impacts our `hover` variant implementation which uses an
// '(hover: hover)' media query to determine if hover is available.
//
// Available values for pointer capabilities:
// NO_POINTER = 0x00;
// COARSE_POINTER = 0x01;
// FINE_POINTER = 0x02;
// HOVER_CAPABLE_POINTER = 0x04;
//
// Setting to 0x02 | 0x04 says the system supports a mouse
'ui.primaryPointerCapabilities': 0x02 | 0x04,
'ui.allPointerCapabilities': 0x02 | 0x04,
},
},
},
},
],
})
11 changes: 11 additions & 0 deletions packages/@tailwindcss-browser/src/assets.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import index from 'tailwindcss/index.css'
import preflight from 'tailwindcss/preflight.css'
import theme from 'tailwindcss/theme.css'
import utilities from 'tailwindcss/utilities.css'

export const css = {
index,
preflight,
theme,
utilities,
}
Loading

0 comments on commit dcf116b

Please sign in to comment.