diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 9be3c9c..743aafe 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -28,21 +28,16 @@ jobs: node-version: ${{ matrix.node-version }} - name: Use cached node_modules - id: cache uses: actions/cache@v3 with: path: node_modules - key: nodeModules-${{ hashFiles('./package.json') }}-${{ matrix.node-version }} - restore-keys: | - nodeModules- + key: nodeModules-${{ hashFiles('./package-lock.json') }}-${{ matrix.node-version }} - name: Install dependencies - if: steps.cache.outputs.cache-hit != 'true' run: npm install - env: - CI: true + + - name: Build + run: npm run build - name: Test run: npm test - env: - CI: true diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index 0ec76a4..ddfa3a2 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -15,7 +15,7 @@ permissions: jobs: prepare: permissions: - contents: write # for softprops/action-gh-release to create GitHub release + contents: write # for softprops/action-gh-release to create GitHub release runs-on: ubuntu-latest @@ -31,16 +31,21 @@ jobs: with: node-version: ${{ matrix.node-version }} registry-url: 'https://registry.npmjs.org' - # cache: 'npm' - # - # - name: Use cached node_modules - # id: cache - # uses: actions/cache@v3 - # with: - # path: node_modules - # key: nodeModules-${{ hashFiles('**/package-lock.json') }}-${{ matrix.node-version }} - # restore-keys: | - # nodeModules- + + - name: Use cached node_modules + uses: actions/cache@v3 + with: + path: node_modules + key: nodeModules-${{ hashFiles('./package-lock.json') }}-${{ matrix.node-version }} + + - name: Install dependencies + run: npm install + + - name: Build + run: npm run build + + - name: Test + run: npm test - name: Resolve version id: vars @@ -54,20 +59,9 @@ jobs: echo "$RELEASE_NOTES" >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV - - name: Install dependencies - # if: steps.cache.outputs.cache-hit != 'true' - run: npm install - env: - CI: true - - - name: Test - run: npm test - env: - CI: true - - name: Release uses: softprops/action-gh-release@v1 with: draft: true tag_name: ${{ env.TAG_NAME }} - body: ${{ env.RELEASE_NOTES }} + body: ${{ env.RELEASE_NOTES }} diff --git a/.github/workflows/release-insiders.yml b/.github/workflows/release-insiders.yml index c6ced95..4a91bf2 100644 --- a/.github/workflows/release-insiders.yml +++ b/.github/workflows/release-insiders.yml @@ -22,30 +22,29 @@ jobs: registry-url: 'https://registry.npmjs.org' - name: Use cached node_modules - id: cache uses: actions/cache@v3 with: path: node_modules - key: nodeModules-${{ hashFiles('**/package.json') }}-${{ matrix.node-version }} - restore-keys: | - nodeModules- + key: nodeModules-${{ hashFiles('./package-lock.json') }}-${{ matrix.node-version }} - name: Install dependencies - if: steps.cache.outputs.cache-hit != 'true' run: npm install - env: - CI: true + + - name: Build + run: npm run build + + - name: Test + run: npm test - name: Resolve version id: vars - run: | + run: | echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV - - name: "Version based on commit: 0.0.0-insiders.${{ env.SHA_SHORT }}" + - name: 'Version based on commit: 0.0.0-insiders.${{ env.SHA_SHORT }}' run: npm version 0.0.0-insiders.${{ env.SHA_SHORT }} --force --no-git-tag-version - name: Publish run: npm publish --tag insiders env: - CI: true NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 67d7f37..2b133f8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,27 +23,21 @@ jobs: with: node-version: ${{ matrix.node-version }} registry-url: 'https://registry.npmjs.org' - # cache: 'npm' - # - # - name: Use cached node_modules - # id: cache - # uses: actions/cache@v3 - # with: - # path: node_modules - # key: nodeModules-${{ hashFiles('**/package-lock.json') }}-${{ matrix.node-version }} - # restore-keys: | - # nodeModules- + + - name: Use cached node_modules + uses: actions/cache@v3 + with: + path: node_modules + key: nodeModules-${{ hashFiles('./package-lock.json') }}-${{ matrix.node-version }} - name: Install dependencies - # if: steps.cache.outputs.cache-hit != 'true' run: npm install - env: - CI: true + + - name: Build + run: npm run build - name: Test run: npm test - env: - CI: true - name: Calculate environment variables run: | @@ -52,5 +46,4 @@ jobs: - name: Publish run: npm publish --tag ${{ env.RELEASE_CHANNEL }} env: - CI: true NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 57071b4..f239b0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Nothing yet! +## [0.1.1] - 2023-03-31 + +### Fixed + +- Ensure types are published to npm ([#11](https://github.com/tailwindlabs/tailwindcss-container-queries/pull/11)) + ## [0.1.0] - 2022-10-19 ### Added @@ -16,5 +22,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add new `@container`, `@container-normal` utilities. - Add new `@xs`, `@sm`, ..., `@[400px]`, variants. -[unreleased]: https://github.com/tailwindlabs/tailwindcss-container-queries/compare/v0.1.0...HEAD +[unreleased]: https://github.com/tailwindlabs/tailwindcss-container-queries/compare/v0.1.1...HEAD +[0.1.1]: https://github.com/tailwindlabs/tailwindcss-container-queries/compare/v0.1.0...v0.1.1 [0.1.0]: https://github.com/tailwindlabs/tailwindcss-container-queries/releases/tag/v0.1.0 diff --git a/README.md b/README.md index 85fe116..634ca32 100644 --- a/README.md +++ b/README.md @@ -27,47 +27,68 @@ module.exports = { ## Usage +Start by marking an element as a container using the `@container` class, and then applying styles based on the size of that container using the container variants like `@md:`, `@lg:`, and `@xl:`: + ```html -
- -
-
+
+ +
+``` + +By default we provide [container sizes](#configuration) from `@xs` (`20rem`) to `@7xl` (`80rem`). + +### Named containers - -
-
-
+You can optionally name containers using a `@container/{name}` class, and then include that name in the container variants using classes like `@lg/{name}:underline`: + +```html +
+ +
+ +
``` -### Container types +### Arbitrary container sizes -| Class | css | -| --------------------------- | ------------------------------------------------------- | -| `@container` | `container-type: inline-size;` | -| `@container/sidebar` | `container-type: inline-size; container-name: sidebar;` | -| `@container-normal` | `container-type: normal;` | -| `@container-normal/sidebar` | `container-type: inline-size; container-name: sidebar;` | +In addition to using one of the [container sizes](#configuration) provided by default, you can also create one-off sizes using any arbitrary value: + +```html +
+
+ +
+
+``` + +### Removing a container + +To stop an element from acting as a container, use the `@container-normal` class. + +
+ +
## Configuration By default we ship with the following configured values: -| Name | Value | -| ----- | ------- | -| `xs` | `20rem` | -| `sm` | `24rem` | -| `md` | `28rem` | -| `lg` | `32rem` | -| `xl` | `36rem` | -| `2xl` | `42rem` | -| `3xl` | `48rem` | -| `4xl` | `56rem` | -| `5xl` | `64rem` | -| `6xl` | `72rem` | -| `7xl` | `80rem` | +| Name | CSS | +| ------ | ------------------------------- | +| `@xs` | `@container (min-width: 20rem)` | +| `@sm` | `@container (min-width: 24rem)` | +| `@md` | `@container (min-width: 28rem)` | +| `@lg` | `@container (min-width: 32rem)` | +| `@xl` | `@container (min-width: 36rem)` | +| `@2xl` | `@container (min-width: 42rem)` | +| `@3xl` | `@container (min-width: 48rem)` | +| `@4xl` | `@container (min-width: 56rem)` | +| `@5xl` | `@container (min-width: 64rem)` | +| `@6xl` | `@container (min-width: 72rem)` | +| `@7xl` | `@container (min-width: 80rem)` | You can configure which values are available for this plugin under the `containers` key in your `tailwind.config.js` file: @@ -77,12 +98,7 @@ module.exports = { theme: { extend: { containers: { - xs: '20rem', - sm: '24rem', - md: '28rem', - lg: '32rem', - xl: '36rem', - // etc... + '2xs': '16rem', }, }, }, diff --git a/package.json b/package.json index 448d3bc..6b08cb7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tailwindcss/container-queries", - "version": "0.1.0", + "version": "0.1.1", "main": "dist/index.js", "types": "dist/index.d.ts", "license": "MIT", @@ -36,7 +36,7 @@ } }, "files": [ - "./dist/*" + "dist" ], "peerDependencies": { "tailwindcss": ">=3.2.0"