-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🩹✨ fix(patch): importable tailwindcss; fix @roots/sage error logs (#1703
) - moves the tailwind config handlers out of `@roots/sage` into `@roots/bud-tailwindcss` - generates virtual modules for tailwind config values aliased to `@tailwind` Generating the imports can be memory intensive and increase build times, so it is opt-in. Generating an import for every `theme` key: ```ts app.tailwind.generateImports() ``` Generating an import for specific keys: ```ts app.tailwind.generateImports([`colors`, `fontFamily`]) ``` Generating an import for specific used keys is a lot less intensive than generating imports for everything. In the future we can add a NormalModule plugin to do this automatically. Anyway, on to an example of using the generated imports in app code: ```ts import {black} from '@tailwind/colors' import {sans} from '@tailwind/fontFamily' export const main = () => { document.body.style.backgroundColor = black document.body.style.fontFamily = sans } ``` This is a lot better than trying to import the actual `tailwind.config.js` file to read these values as the values are fully resolved (merged with `defaultTheme`, plugins applied, etc.) And it's a lot better than importing `tailwindcss/resolveConfig` and doing it in the app code because of the transitive dependencies taken on by that import. It's also better than pre-compiling a static json file because these values are tree-shakeable. The entire generated json for the default tailwind config is ~100kb. The above example adds ~5kb to the overall bundle (and only because tailwind has so many default colors). If you don't import from `@tailwindcss/*` nothing is added to the bundle (even if the imports are generated) refers: - none ## Type of change **PATCH: backwards compatible change** This PR includes breaking changes to the following core packages: - none This PR includes breaking changes to the follow extensions: - none ## Dependencies ### Adds - none ### Removes - none
- Loading branch information
1 parent
ca49027
commit 40b1448
Showing
17 changed files
with
1,665 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
const body = document.querySelector('body') | ||
import * as colors from '@tailwind/colors' | ||
|
||
const changeBg = () => { | ||
body.classList = '' | ||
body.classList.add('bg-indigo-600') | ||
} | ||
document.body.style.backgroundColor = colors.indigo[600] | ||
|
||
changeBg() | ||
|
||
module?.hot?.accept(err => changeBg()) | ||
module?.hot?.accept(console.error) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
slug: '6.4.2' | ||
title: 'Release: 6.4.2' | ||
description: 'Release notes for bud.js 6.4.2' | ||
date: 2022-08-23 | ||
author: Kelly Mears | ||
author_title: Lead developer | ||
author_url: https://github.com/kellymears | ||
author_image_url: https://avatars.githubusercontent.com/u/397606?v=4 | ||
tags: [release] | ||
--- | ||
|
||
<!--truncate--> | ||
|
||
## 👉🏼 known issue: [@roots/sage] errors logged when not using tailwindcss | ||
|
||
If you are not using `@roots/bud-tailwindcss` you will see errors in the logs when running `bud build` or `bud dev`. | ||
This is a known issue and will be resolved in the next release. It isn't a sign that anything is wrong in your project. | ||
|
||
## ✨ improve: [@roots/sage] `bud.wpjson` now fully resolves tailwind configs | ||
|
||
Previously, `bud.wpjson` could only generate a `theme.json` based on a fully static tailwind config file. This excluded tailwind configs that | ||
defined theme properties using functions and also meant that plugins would not be applied. | ||
|
||
Now, `bud.wpjson` functions related to tailwindcss will fully resolve the tailwind config file and generate a `theme.json` based on the | ||
processed config. This should mean that _any_ tailwind config can be used in conjunction with `bud.wpjson.useTailwindColors()` and similar functions. | ||
|
||
## 🩹 fix: build errors return non-zero exit code | ||
|
||
For production builds, build errors will now result in a non-zero exit code. This regression was introduced in 6.4.0. It is now fixed. | ||
|
||
## 🩹 fix: eslint.config.js support | ||
|
||
`eslint.config.js` configurations are now supported. | ||
|
||
## 🩹 fix: bud repl | ||
|
||
The `bud repl` command has seen significant improvements since 6.4.0. It fixes a bug in 6.4.1 related to syntax highlighting. | ||
|
||
## ℹ️ Release information | ||
|
||
For more information [review the diff to see what's changed](https://github.com/roots/bud/compare/v6.4.0...v6.4.2). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.