├── .github
├── ISSUE_TEMPLATE
│ ├── 1.bug_report.yml
│ └── config.yml
└── workflows
│ └── release-insiders.yml
├── .gitignore
├── CHANGELOG.md
├── LICENSE
├── README.md
├── package.json
├── src
├── index.d.ts
└── index.js
└── tests
└── test.js
/.github/ISSUE_TEMPLATE/1.bug_report.yml:
--------------------------------------------------------------------------------
1 | name: Bug Report
2 | description: Create a bug report for @tailwindcss/aspect-ratio.
3 | labels: []
4 | body:
5 | - type: input
6 | attributes:
7 | label: What version of @tailwindcss/aspect-ratio are you using?
8 | description: 'For example: v0.2.0'
9 | validations:
10 | required: true
11 | - type: input
12 | attributes:
13 | label: What version of Node.js are you using?
14 | description: 'For example: v12.0.0'
15 | validations:
16 | required: true
17 | - type: input
18 | attributes:
19 | label: What browser are you using?
20 | description: 'For example: Chrome, Safari, or N/A'
21 | validations:
22 | required: true
23 | - type: input
24 | attributes:
25 | label: What operating system are you using?
26 | description: 'For example: macOS, Windows'
27 | validations:
28 | required: true
29 | - type: input
30 | attributes:
31 | label: Reproduction repository
32 | description: A public GitHub repo that includes a minimal reproduction of the bug. Unfortunately we can't provide support without a reproduction, and your issue will be closed and locked with no comment if this is not provided.
33 | validations:
34 | required: true
35 | - type: textarea
36 | attributes:
37 | label: Describe your issue
38 | description: Describe the problem you're seeing, any important steps to reproduce and what behavior you expect instead
39 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: false
2 | contact_links:
3 | - name: Feature Request
4 | url: https://github.com/tailwindlabs/tailwindcss/discussions/new?category=ideas
5 | about: 'Suggest any ideas you have using our discussion forums.'
6 | - name: Help
7 | url: https://github.com/tailwindlabs/tailwindcss/discussions/new?category=help
8 | about: 'If you have a question or need help, ask a question on the discussion forums.'
9 | - name: Kind Words
10 | url: https://github.com/tailwindlabs/tailwindcss/discussions/new?category=kind-words
11 | about: "Have something nice to say about @tailwindcss/aspect-ratio or Tailwind CSS in general? We'd love to hear it!"
12 |
--------------------------------------------------------------------------------
/.github/workflows/release-insiders.yml:
--------------------------------------------------------------------------------
1 | name: Release Insiders
2 |
3 | on:
4 | push:
5 | branches: [master]
6 |
7 | permissions:
8 | contents: read
9 | id-token: write
10 |
11 | jobs:
12 | build:
13 | runs-on: ubuntu-latest
14 |
15 | strategy:
16 | matrix:
17 | node-version: [12]
18 |
19 | steps:
20 | - uses: actions/checkout@v2
21 |
22 | - name: Use Node.js ${{ matrix.node-version }}
23 | uses: actions/setup-node@v2
24 | with:
25 | node-version: ${{ matrix.node-version }}
26 | registry-url: 'https://registry.npmjs.org'
27 |
28 | - name: Use cached node_modules
29 | id: cache
30 | uses: actions/cache@v2
31 | with:
32 | path: node_modules
33 | key: nodeModules-${{ hashFiles('**/package-lock.json') }}-${{ matrix.node-version }}
34 | restore-keys: |
35 | nodeModules-
36 |
37 | - name: Install dependencies
38 | if: steps.cache.outputs.cache-hit != 'true'
39 | run: npm install
40 | env:
41 | CI: true
42 |
43 | - name: Resolve version
44 | id: vars
45 | run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
46 |
47 | - name: 'Version based on commit: 0.0.0-insiders.${{ steps.vars.outputs.sha_short }}'
48 | run: npm version 0.0.0-insiders.${{ steps.vars.outputs.sha_short }} --force --no-git-tag-version
49 |
50 | - name: Publish
51 | run: npm publish --provenance --tag insiders
52 | env:
53 | CI: true
54 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
55 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | yarn.lock
3 | package-lock.json
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | All notable changes to this project will be documented in this file.
4 |
5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7 |
8 | ## [Unreleased]
9 |
10 | - Nothing yet!
11 |
12 | ## [0.4.2] - 2022-09-02
13 |
14 | ### Fixed
15 |
16 | - Update TypeScript types ([#34](https://github.com/tailwindlabs/tailwindcss-aspect-ratio/pull/34))
17 |
18 | ## [0.4.1] - 2022-09-01
19 |
20 | ### Added
21 |
22 | - Remove `dist` folder and related dependencies ([#29](https://github.com/tailwindlabs/tailwindcss-aspect-ratio/pull/29))
23 | - Add typescript types ([#33](https://github.com/tailwindlabs/tailwindcss-aspect-ratio/pull/33))
24 |
25 | ## [0.4.0] - 2021-12-09
26 |
27 | ### Added
28 |
29 | - Make sure that Tailwind CSS v3 is in peerDependencies ([ae97a25](https://github.com/tailwindlabs/tailwindcss-aspect-ratio/commit/ae97a25))
30 |
31 | ## [0.3.0] - 2021-10-05
32 |
33 | ### Added
34 |
35 | - Support arbitrary values in Tailwind CSS v3.0.0-alpha.1, via the new `matchComponents` API
36 |
37 | ## [0.2.2] - 2021-10-02
38 |
39 | ### Fixed
40 |
41 | - Fix compatibility with Tailwind CSS v3.0.0-alpha.1
42 |
43 | ## [0.2.1] - 2021-05-24
44 |
45 | ### Fixed
46 |
47 | - Mark `tailwindcss` as peer-dependency for better monorepo support ([#14](https://github.com/tailwindlabs/tailwindcss-aspect-ratio/pull/14))
48 |
49 | ## [0.2.0] - 2020-11-16
50 |
51 | ### Changed
52 |
53 | - Prefix custom properties with `tw-` to match Tailwind CSS v2.0 convention ([6802588](https://github.com/tailwindlabs/tailwindcss-aspect-ratio/commit/6802588))
54 |
55 | ## [0.1.4] - 2020-11-06
56 |
57 | ### Added
58 |
59 | - Add `aspect-none` clas ([73b57ef](https://github.com/tailwindlabs/tailwindcss-aspect-ratio/commit/73b57ef))
60 |
61 | ## [0.1.3] - 2020-11-06
62 |
63 | ### Fixed
64 |
65 | - Remove debugging statements ([32d68f5](https://github.com/tailwindlabs/tailwindcss-aspect-ratio/commit/32d68f5))
66 |
67 | ## [0.1.2] - 2020-11-06
68 |
69 | ### Fixed
70 |
71 | - Remove incorrect peer dependencies ([d46bf8f](https://github.com/tailwindlabs/tailwindcss-aspect-ratio/commit/d46bf8f))
72 |
73 | ## [0.1.1] - 2020-11-06
74 |
75 | ### Fixed
76 |
77 | - Fix entry point so it even works at all ([88fd2f1](https://github.com/tailwindlabs/tailwindcss-aspect-ratio/commit/88fd2f1))
78 |
79 | ## [0.1.0] - 2020-11-06
80 |
81 | Initial release!
82 |
83 | [unreleased]: https://github.com/tailwindlabs/tailwindcss-aspect-ratio/compare/v0.4.2...HEAD
84 | [0.4.2]: https://github.com/tailwindlabs/tailwindcss-aspect-ratio/compare/v0.4.1...v0.4.2
85 | [0.4.1]: https://github.com/tailwindlabs/tailwindcss-aspect-ratio/compare/v0.4.0...v0.4.1
86 | [0.4.0]: https://github.com/tailwindlabs/tailwindcss-aspect-ratio/compare/v0.3.0...v0.4.0
87 | [0.3.0]: https://github.com/tailwindlabs/tailwindcss-aspect-ratio/compare/v0.2.2...v0.3.0
88 | [0.2.2]: https://github.com/tailwindlabs/tailwindcss-aspect-ratio/compare/v0.2.1...v0.2.2
89 | [0.2.1]: https://github.com/tailwindlabs/tailwindcss-aspect-ratio/compare/v0.2.0...v0.2.1
90 | [0.2.0]: https://github.com/tailwindlabs/tailwindcss-aspect-ratio/compare/v0.1.4...v0.2.0
91 | [0.1.4]: https://github.com/tailwindlabs/tailwindcss-aspect-ratio/compare/v0.1.3...v0.1.4
92 | [0.1.3]: https://github.com/tailwindlabs/tailwindcss-aspect-ratio/compare/v0.1.2...v0.1.3
93 | [0.1.2]: https://github.com/tailwindlabs/tailwindcss-aspect-ratio/compare/v0.1.1...v0.1.2
94 | [0.1.1]: https://github.com/tailwindlabs/tailwindcss-aspect-ratio/compare/v0.1.0...v0.1.1
95 | [0.1.0]: https://github.com/tailwindlabs/tailwindcss-aspect-ratio/releases/tag/v0.1.0
96 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) Tailwind Labs
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # @tailwindcss/aspect-ratio
2 |
3 | A plugin that provides a composable API for giving elements a fixed aspect ratio.
4 |
5 |
6 | ## Installation
7 |
8 | Install the plugin from npm:
9 |
10 | ```sh
11 | npm install -D @tailwindcss/aspect-ratio
12 | ```
13 |
14 | Then add the plugin to your `tailwind.config.js` file, and disable the `aspectRatio` core plugin to avoid conflicts with the native `aspect-ratio` utilities included in Tailwind CSS v3.0:
15 |
16 | ```js
17 | // tailwind.config.js
18 | module.exports = {
19 | theme: {
20 | // ...
21 | },
22 | corePlugins: {
23 | aspectRatio: false,
24 | },
25 | plugins: [
26 | require('@tailwindcss/aspect-ratio'),
27 | // ...
28 | ],
29 | }
30 | ```
31 |
32 | ## Usage
33 |
34 | Combine the `aspect-w-{n}` and `aspect-h-{n}` classes to specify the aspect ratio for an element:
35 |
36 | ```html
37 |
38 |
39 |
40 | ```
41 |
42 | Use `aspect-none` to remove any aspect ratio behavior:
43 |
44 | ```html
45 |
46 |
47 |
48 | ```
49 |
50 | When removing aspect ratio behavior, if nested elements have `w-{n}` or `h-{n}` classes, ensure they are re-declared with a matching breakpoint prefix:
51 |
52 | ```html
53 |