@designbycode/tailwindcss-text-stroke

中文文档
1.3.0发布于 2024/11/22MITTypeScriptESM + CJS零依赖近 30 天下载 6132

Tailwindcss utilities for text stroke

原始使用文档
文档目录12 节
  1. Tailwind CSS Text Stroke Plugin
  2. 📇 Table of Contents
  3. Installation
  4. Setup
  5. Use
  6. Example
  7. With modifiers
  8. Contributing
  9. License
  10. Author
  11. Claude Myburgh
  12. Acknowledgments
Title banner

Tailwind CSS Text Stroke Plugin

npm version npm NPM npm bundle size ts GitHub stars

NPM

Add custom text stroke utilities to your Tailwind CSS project using this plugin. It allows you to apply an outline-like stroke around text using CSS properties supported by WebKit-based browsers.

📇 Table of Contents

Installation

To use this plugin, you need to install it via pnpm, npm or yarn.

Using pnpm

pnpm add @designbycode/tailwindcss-text-stroke

Using npm

npm install @designbycode/tailwindcss-text-stroke

Using yarn

yarn add @designbycode/tailwindcss-text-stroke

First, ensure you have Tailwind CSS installed in your project. If not, install it by following the official documentation.

Next, require the plugin in your Tailwind CSS configuration file (usually named tailwind.config.js).

Setup

  1. First, ensure you have Tailwind CSS installed in your project. If not, install it by following the official documentation.

  2. Next, require the plugin in your Tailwind CSS configuration file (usually named tailwind.config.js).

module.exports = {
    // ...other configurations
    plugins: [
        // ...other plugins
        require("@designbycode/tailwindcss-text-stroke"),
    ],
};

Once you've required the plugin and added it to the plugins array, you can use the new text stroke utilities in your HTML templates.

Use

The Text Stroke plugin provides the following utility classes for styling text with stroke effects:

  • .text-stroke: Base component that sets the default text stroke styles. You can override these styles using CSS variables.
  • .text-stroke-{value}: Sets the stroke width to the specified {value}. The available options are defined in the textStrokeWidth theme configuration.
  • .text-stroke-{color}: Applies a custom color to the text stroke. The {color} should match a color in your Tailwind CSS color palette.
  • .text-stroke-fill-{color}: Applies a custom fill color to the text stroke. The {color} should match a color in your Tailwind CSS color palette.

Example

Here's an example of how you can use the utility classes to apply image masks:

<h1 class="text-7xl font-black text-stroke ">
    Hello, TailwindCSS
</h1>

With modifiers

<h1 class="text-7xl font-black text-stroke text-stroke-indigo-200 text-stroke-fill-indigo-600">
    Hello, TailwindCSS
</h1>

Contributing

Contributions to this plugin are welcome! If you encounter any issues, have feature requests, or want to improve the plugin, feel free to create a pull request or submit an issue on the GitHub repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Claude Myburgh

Claude Myburgh

Acknowledgments

  • This plugin is inspired by the needs of web developers using Tailwind CSS.
  • Special thanks to the Tailwind CSS team for creating such an amazing framework.

版本与发布记录

@designbycode/tailwindcss-text-stroke 共发布 7 个版本,首次发布于 2023/08/05;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.3.0latest2024/11/222 年前
1.2.12023/08/113 年前
1.2.02023/08/113 年前
1.1.22023/08/083 年前
1.1.12023/08/083 年前
1.0.12023/08/053 年前

关于 @designbycode/tailwindcss-text-stroke 的常见问题

@designbycode/tailwindcss-text-stroke 是什么?

Tailwindcss utilities for text stroke

如何安装 @designbycode/tailwindcss-text-stroke?

在项目目录运行 npm install @designbycode/tailwindcss-text-stroke,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:tailwindcss(>=3.0.0 || >=3.0.0-alpha.1)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@designbycode/tailwindcss-text-stroke 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@designbycode/tailwindcss-text-stroke 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@designbycode/tailwindcss-text-stroke 可以商用吗?

@designbycode/tailwindcss-text-stroke 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@designbycode/tailwindcss-text-stroke 的下载量有多少?

根据 npm 官方下载统计,@designbycode/tailwindcss-text-stroke 在 2026/10/12 – 2026/11/10 这 30 天内被下载 6,132 次,日均约 204 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@designbycode/tailwindcss-text-stroke 还在维护吗?

最新版本 1.3.0 发布于 2024/11/22(2 年前);至今共发布 7 个版本,其中过去 12 个月发布了 0 个;首次发布于 2023/08/05。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。