定制 jramke/tailwind-styled-content 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jramke/tailwind-styled-content

Composer 安装命令:

composer require jramke/tailwind-styled-content

包简介

Fluid templates for TYPO3 content elements with Tailwind CSS.

README 文档

README

Note

This extension is currently not maintained. I recommend using Tailwind v4 instead of v3 and just copy paste the things you need from this extension directly into your sitepackage. Also DaisyUI might not be the best choice for your project anymore. Maybe you would like to consider Fluid Primitives.

Tailwind Styled Content

Total downloads Stability TYPO3 versions Latest version

Easily use TYPO3 with Tailwind CSS. Tailwind Styled Content is an alternative for fluid_styled_content using Tailwind CSS, providing a clean, robust and modern starting point for building websites with TYPO3.

TYPO3 + Tailwind CSS

What's Included

Content Elements

Tailwind Styled Content ships basic templates for (not all) default content elements. Its important to say, that we made some opinionated adjustments and settings. Thats why it is not a drop in replacement for fluid_styled_content and is more suitable for new projects.

  • Simplified content elements layout
  • Removed and added some frame_class options
  • New .frame spacing api
  • Overhauled textmedia template and gallery partial
  • Removed and added some imageorient options
  • Disabled the following content elements
    • textpic (in favor of textmedia)
    • table (in favor of RTE table)
    • bullets (in favor of RTE lists)

Refer to the individual files for more details.

We’ve also introduced a Prose partial, which can be used as follows:

<f:render partial="Prose" contentAs="content">
    <!-- content -->
</f:render>

Form Elements

We override the default form element classes via YAML, as they were originally designed for Bootstrap. We use the form templates of version2.

Tailwind Plugins and Preset

Tailwind Styled Content comes with a Tailwind preset, a safelist and a plugin, which you can directly import from the composer package. No need for an additional npm package.

The preset extends Tailwind's default theme to better suit TYPO3 websites. It also includes the needed plugins like daisyUI, which makes Tailwind usable for non-component-based JS frameworks and tailwindcss/typography for RTE and default heading styling.

The Tailwind Styled Content plugin uses the .frame class to add robust and flexible spacing to all content elements. The combo classes added by the space_before_class and space_after_class fields, to adjusts the spacing of individual content elements, look like this: frame-space-(before|after)-(none|small|large). For further customization, check out the customization section.

Getting Started

1. Install Tailwind Styled Content (TSC)

Install it via Composer:

composer req jramke/tailwind-styled-content

Note: For legacy installations, use the Extension Manager in the backend. Make sure to adjust the paths in your Tailwind config.

2. Initialize Tailwind

To initialize Tailwind, use PostCSS as recommended. Follow these instructions: Tailwind CSS Installation using PostCSS.

For an easy setup, use vite-asset-collector by Simon Praetorius and simply import the your CSS file in your JS entry file. More info here: Vite Asset Collector.

3. Install Additional Dependencies

As Tailwind Styled Content relies on daisyUI and @tailwindcss/typography, you need to install them as development dependencies:

npm i -D daisyui@latest @tailwindcss/typography

4. Set Up Your Tailwind Config

Add Tailwind Styled Content to your tailwind.config.js. You'll need to define the content paths and safelist yourself, as they’re not merged with the preset.

import { preset, safelist } from './vendor/jramke/tailwind-styled-content';

/** @type {import('tailwindcss').Config} */
module.exports = {
    presets: [preset],
    content: [
        './vendor/jramke/tailwind-styled-content/**/*.{html,yaml,typoscript,tsconfig}',
        'packages/**/*.{html,js,yaml,typoscript,tsconfig,xml}',
    ],
    safelist: [...safelist],
}

Customization

Tailwind

For basic Tailwind customization, refer to the Tailwind docs.

daisyUI

To customize daisyUI, I would recommend this approach, where you extend an existing theme with your brand colors. More details are available in the daisyUI docs.

Tailwind Styled Content (TSC)

To customize Tailwind Styled Content, use the tsc object in your Tailwind config.

You can tweak the .frame component’s CSS by adjusting the default vertical padding, breakpoint-specific padding, and spacing for the combo classes. Set frame: false to opt-out of these styles entirely.

The default config looks like this:

tsc: {
    frame: {
        default: '2.5rem',
        screens: {
            lg: '3.5rem',
        },
        multipliers: {
            small: '1.5',
            large: '1.5',
        },
    },
}

Tailwind Typography

To customize the typography styles, extend your Tailwind config or override the Prose.html partial in your distribution extension. Learn more here.

Development

The development setup uses DDEV and is based on this example.

Start DDEV Project

ddev start

Install JavaScript Dependencies

npm install

TYPO3

1. Setup the TYPO3 development environment for the needed version

ddev install-v11
ddev install-v12
ddev install-v13

The installations are then available at:

You can log into the backend with username admin and password Password1#.

2. Restore base database

ddev snapshot restore dev-base

or manually include the Tailwind Styled Content static TypoScript file and add this to the template:

page.includeCSS {
    tailwind = output.css
    tailwind {
        disableCompression = 1
        excludeFromConcatenation = 1
    }
}

4. Start the Tailwind CLI build process

Replace [VERSION] with the desired installation version (e.g. v12):

ddev exec -d /var/www/html/[VERSION] npm run tailwind

jramke/tailwind-styled-content 适用场景与选型建议

jramke/tailwind-styled-content 是一款 基于 HTML 开发的 Composer 扩展包,目前已累计 1.21k 次下载、GitHub Stars 达 6, 最近一次更新时间为 2024 年 07 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 jramke/tailwind-styled-content 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 jramke/tailwind-styled-content 我们能提供哪些服务?
定制开发 / 二次开发

基于 jramke/tailwind-styled-content 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.21k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 18
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 1
  • Forks: 1
  • 开发语言: HTML

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2024-07-26