Skip to content

Commit fdb4c65

Browse files
aggrekazuyoshi80
andauthored
Tailwind v4 (#1886)
* using tailwind v4 * Refactor modal components' styling for better responsiveness. Adjusted class properties in Modal.vue and ModalCheckout.vue to improve positioning, alignment, and styling consistency. Simplified some redundant CSS class definitions and added inline styles where necessary for enhanced layout control. * Refactor modal components' styling for better responsiveness. Adjusted class properties in Modal.vue and ModalCheckout.vue to improve positioning, alignment, and styling consistency. Simplified some redundant CSS class definitions and added inline styles where necessary for enhanced layout control. * Refactor Sass build script to improve import structure. Replaced individual imports with namespace imports for better clarity. Updated function and export syntax to align with modern JavaScript standards. This refactor simplifies the code and enhances maintainability. * Refactor Sass build script to improve import structure. Replaced individual imports with namespace imports for better clarity. Updated function and export syntax to align with modern JavaScript standards. This refactor simplifies the code and enhances maintainability. * Convert sass-build.ts to an ES module Renamed the file to .mjs and updated it to follow ES module standards. This change ensures compatibility with modern JavaScript module systems. * Update build script to use Gulp instead of custom SASS Switches from a custom SASS build script to Gulp for improved maintainability and integration. Adjusts build configuration accordingly to streamline the development workflow. * Update Sass build to use a JavaScript gulpfile Replaced the TypeScript-based sass-build.ts with sass-build.mjs for the gulpfile. Updated the build script in package.json accordingly to ensure compatibility with the new JavaScript file. * Update import syntax for gulp-sass and sass compatibility Standardize the import statement for better compatibility with modern JavaScript module practices. This change ensures consistency and resolves potential import issues when using the `sass` compiler. --------- Co-authored-by: kazuyoshi80 <[email protected]> Co-authored-by: kazuyoshi kawakami <[email protected]>
1 parent dbd8fb5 commit fdb4c65

File tree

10 files changed

+323
-321
lines changed

10 files changed

+323
-321
lines changed

.preview/astro.config.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { defineConfig } from 'astro/config'
22
import react from '@astrojs/react'
33
import vue from '@astrojs/vue'
4-
import tailwind from '@astrojs/tailwind'
54
import svelte from '@astrojs/svelte'
5+
import tailwindcss from '@tailwindcss/vite'
66

77
export default defineConfig({
8-
server: {
9-
port: 3000,
10-
},
118
output: 'server',
12-
integrations: [vue(), react(), svelte(), tailwind()],
9+
integrations: [vue(), react(), svelte()],
10+
vite: {
11+
plugins: [tailwindcss()],
12+
},
1313
})

.preview/src/pages/[...page].astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
import '../styles/global.css'
23
import {
34
pageFactory,
45
encode,

.preview/src/pages/admin/[...page].astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
import '../../styles/global.css'
23
import { Admin } from '../../../../src/layouts'
34
import { adminFactory, encode } from '../../../../src/'
45
import example from '../../../../example/index'

.preview/src/styles/global.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@import 'tailwindcss';
2+
@config '../../../tailwind.config.js';

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
"preview:ui:tsc": "yarn build:ts --watch",
8787
"preview:ui:rollup": "yarn build:rollup:ui -w",
8888
"build": "yarn build:sass && yarn build:ts && yarn build:rollup:ui && yarn build:rollup",
89-
"build:sass": "yarn gulp --gulpfile=\"sass-build.ts\"",
89+
"build:sass": "yarn gulp --gulpfile=\"sass-build.mjs\"",
9090
"build:ts": "tsc -p tsconfig.build.json",
9191
"build:rollup": "rollup -c",
9292
"build:rollup:ui": "rollup -c rollup.config.ui.mjs",
@@ -127,13 +127,13 @@
127127
"@astrojs/lit": "4.3.0",
128128
"@astrojs/react": "3.6.3",
129129
"@astrojs/svelte": "6.0.2",
130-
"@astrojs/tailwind": "5.1.2",
131130
"@astrojs/vue": "4.5.3",
132131
"@eslint/js": "^9.12.0",
133132
"@rollup/plugin-commonjs": "28.0.1",
134133
"@rollup/plugin-multi-entry": "6.0.1",
135134
"@rollup/plugin-typescript": "12.1.1",
136135
"@rollup/pluginutils": "5.1.3",
136+
"@tailwindcss/vite": "^4.0.7",
137137
"@types/dompurify": "^3.0.4",
138138
"@types/eslint-config-prettier": "^6.11.3",
139139
"@types/eslint__js": "^8.42.3",
@@ -174,7 +174,7 @@
174174
"sass": "1.81.1",
175175
"svelte": "5.4.0",
176176
"svelte-check": "^4.0.0",
177-
"tailwindcss": "3.4.15",
177+
"tailwindcss": "^4.0.7",
178178
"typedoc": "^0.27.0",
179179
"typescript": "5.6.3",
180180
"typescript-eslint": "^8.8.0",
@@ -186,7 +186,6 @@
186186
"@astrojs/lit": "^1.0.1 || ^2.0.0 || ^3.0.0 || ^4.0.0",
187187
"@astrojs/react": "^1.2.2 || ^2.0.0 || ^3.0.0",
188188
"@astrojs/svelte": "^1.0.2 || ^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0",
189-
"@astrojs/tailwind": "^2.1.3 || ^3.0.0 || ^4.0.0 || ^5.0.0",
190189
"@astrojs/vue": "^1.2.2 || ^2.0.0 || ^3.0.0 || ^4.0.0",
191190
"astro": "^3.0.0 || ^4.0.0",
192191
"ethers": "^6.0.0",

sass-build.mjs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import gulp from 'gulp'
2+
import gulpSass from 'gulp-sass/legacy.js'
3+
import * as sass from 'sass'
4+
5+
const sassCompiler = gulpSass(sass)
6+
7+
export function sassTaskDev() {
8+
return gulp
9+
.src(['src/styles/global.scss'], {
10+
sourcemaps: true,
11+
})
12+
.pipe(
13+
sassCompiler({
14+
includePaths: ['node_modules'],
15+
}).on('error', sassCompiler.logError)
16+
)
17+
.pipe(gulp.dest('./src/styles/build', { sourcemaps: '.' }))
18+
}
19+
20+
export default gulp.series(sassTaskDev)

sass-build.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/ui/components/Checkout/ModalCheckout.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ onMounted(async () => {
148148

149149
<template>
150150
<div
151-
class="relative w-full max-w-screen-lg rounded-xl bg-white p-4 text-black shadow @container/clb_result_modal"
151+
class="relative w-full max-w-screen-lg rounded-xl bg-white p-4 text-black shadow"
152152
>
153153
<a
154154
:href="props.base ?? '/'"
@@ -174,7 +174,8 @@ onMounted(async () => {
174174
class="bg-color-navy relative mb-6 flex h-auto min-h-52 w-full flex-col items-center justify-center overflow-hidden rounded-md border border-black p-2 @xl/clb_result_modal:h-96 @xl/clb_result_modal:min-h-0 @xl/clb_result_modal:p-8"
175175
>
176176
<div
177-
class="w-h-screen bg-focus-lines origin-zero animate-spin-slow mask absolute inset-2/4 -translate-x-1/2 -translate-y-1/2 bg-center bg-no-repeat"
177+
class="w-h-screen bg-focus-lines origin-zero animate-spin-slow mask absolute inset-2/4 bg-center bg-no-repeat"
178+
style="transform: translate(50%, 50%)"
178179
></div>
179180
<h3 class="mb-1 text-white">
180181
<span

src/ui/components/Modal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ html:has(dialog[open]) {
4545
<template>
4646
<dialog
4747
ref="dialog"
48-
class="fixed inset-0 m-auto box-border flex h-full max-h-full w-auto w-full max-w-full items-center justify-center overflow-y-auto bg-transparent backdrop:bg-black/60"
48+
class="m-auto box-border flex h-full w-full items-center justify-center overflow-y-auto bg-transparent backdrop:bg-black/60"
4949
:class="{ hidden: !isVisible }"
5050
>
5151
<Transition>

0 commit comments

Comments
 (0)