automic-style-engine

中文文档
1.2.6发布于 2026/11/03MITCommonJS

A configurable, namespaced Animate.css integration for Tailwind CSS

原始使用文档
文档目录9 节
  1. Installation
  2. Basic usage
  3. Configuration
  4. Generated utilities
  5. Aliases
  6. Catalog
  7. Project structure
  8. Migration from 1.x
  9. License

automic-style-engine

A configurable Animate.css integration for Tailwind CSS 3. It reads the installed Animate.css catalog at build time, emits only the animations you select, and namespaces generated keyframes to prevent collisions.

Global duration, delay, and iterationCount values are passed to @utilityforge/dynamic-interface-kit, which generates the corresponding Tailwind base custom properties.

Installation

npm install automic-style-engine animate.css

Basic usage

// tailwind.config.js
module.exports = {
  content: ['./src/**/*.{html,js,jsx,ts,tsx,vue,svelte}'],
  plugins: [
    require('automic-style-engine')({
      animations: ['bounce', 'fadeIn', 'fadeOut', 'slideInUp']
    })
  ]
};

Apply the base class together with an animation class:

<div class="keyframe keyframe-fade-in">Content</div>

Animation names are converted to kebab case in generated class names. For example, fadeInDownBig becomes keyframe-fade-in-down-big.

Configuration

require('automic-style-engine')({
  prefix: 'motion',
  animations: ['bounce', 'fadeIn'],
  exclude: ['bounce'],
  aliases: {
    enter: 'fadeIn'
  },
  duration: '900ms',
  delay: '0s',
  iterationCount: '1',
  namespaceKeyframes: true,
  respectReducedMotion: true,
  modifiers: true,
  durations: {
    quick: '300ms',
    deliberate: '1400ms'
  },
  delays: {
    short: '150ms',
    long: '800ms'
  },
  repeats: {
    twice: '2',
    forever: 'infinite'
  }
})
OptionDefaultPurpose
prefixkeyframePrefix for classes and generated keyframes
animations'*'Animate.css names to include; '*' includes the full catalog
exclude[]Animation names to omit
aliases{}Public class names mapped to Animate.css animation names
duration1sDefault animation duration
delay0sDefault animation delay
iterationCount1Default iteration count
namespaceKeyframestruePrefix keyframe identifiers to prevent collisions
respectReducedMotiontrueMinimize animation when the user requests reduced motion
modifierstrueGenerate timing, repeat, pause, and run utilities
durationsBuilt-in mapDuration modifier tokens
delaysBuilt-in mapDelay modifier tokens
repeatsBuilt-in mapIteration modifier tokens

The deprecated classes option remains an alias for animations during migration.

Generated utilities

With the default prefix, the plugin generates:

<div class="keyframe keyframe-bounce keyframe-duration-fast keyframe-delay-1s keyframe-repeat-2"></div>
  • keyframe-duration-{token} sets the duration variable.
  • keyframe-delay-{token} sets the delay variable.
  • keyframe-repeat-{token} sets the iteration-count variable.
  • keyframe-paused and keyframe-running control playback.

Tailwind variants work normally:

<div class="keyframe keyframe-fade-in hover:keyframe-paused md:keyframe-duration-slow"></div>

Aliases

Aliases provide stable semantic names without copying keyframes:

require('automic-style-engine')({
  animations: [],
  aliases: {
    notificationEnter: 'fadeInDown',
    notificationExit: 'fadeOutUp'
  }
})
<aside class="keyframe keyframe-notification-enter"></aside>

Catalog

The package exposes the animation names found in the installed Animate.css version:

const animateCatalog = require('automic-style-engine');
console.log(animateCatalog.catalog());

Project structure

index.js                  Tailwind plugin entry point
lib/
  shared/                 Package constants, error helper, case conversion
  options/                Defaults, validation, and option normalization
  catalog/                Animate.css loading, parsing, and selection
  styles/                 Base variables, utilities, keyframes, reduced motion
test/                     node:test suites

Migration from 1.x

  • The default class prefix changed from animatecss to keyframe.
  • Generated animation class names use kebab case.
  • Keyframe names are namespaced by default.
  • animations replaces classes; classes remains a compatibility alias.
  • @utilityforge/dynamic-interface-kit now processes global timing options and is installed automatically.
  • Reduced-motion handling is enabled by default.

License

MIT

版本与发布记录

automic-style-engine 共发布 2 个版本,首次发布于 2026/11/03;过去 12 个月发布了 2 个版本。

版本发布日期距今
1.2.6latest2026/11/03今天
0.0.0-stage2026/11/03今天

关于 automic-style-engine 的常见问题

automic-style-engine 是什么?

一个可配置的、命名空间的Animate.css集成,用于顺风CSS

如何安装 automic-style-engine?

在项目目录运行 npm install automic-style-engine,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:tailwindcss(^3)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

automic-style-engine 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/automic-style-engine 是否存在。

automic-style-engine 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

automic-style-engine 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

automic-style-engine 可以商用吗?

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

automic-style-engine 还在维护吗?

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