Skip to content

Commit

Permalink
feat: add weapp-tailwindcss style
Browse files Browse the repository at this point in the history
  • Loading branch information
sonofmagic committed Feb 8, 2025
1 parent 1b1f7c2 commit ce8851a
Show file tree
Hide file tree
Showing 18 changed files with 923 additions and 872 deletions.
2 changes: 1 addition & 1 deletion apps/vite-native-skyline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
"tailwindcss": "^3.4.17",
"typescript": "^5.7.3",
"weapp-tailwindcss": "workspace:*",
"weapp-vite": "^2.1.2"
"weapp-vite": "^2.1.3"
}
}
2 changes: 1 addition & 1 deletion apps/vite-native-ts-skyline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
"tailwindcss": "^3.4.17",
"typescript": "^5.7.3",
"weapp-tailwindcss": "workspace:*",
"weapp-vite": "^2.1.2"
"weapp-vite": "^2.1.3"
}
}
2 changes: 1 addition & 1 deletion apps/vite-native-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@
"tailwindcss": "^3.4.17",
"typescript": "^5.7.3",
"weapp-tailwindcss": "workspace:*",
"weapp-vite": "^2.1.2"
"weapp-vite": "^2.1.3"
}
}
5 changes: 4 additions & 1 deletion apps/vite-native/app.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/* @import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities'; */
@import 'tailwindcss';

/* @import 'tailwindcss'; */

@import 'weapp-tailwindcss';
@config "./tailwind.config.js";
2 changes: 1 addition & 1 deletion apps/vite-native/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"navigationBarBackgroundColor": "#ffffff"
},
"usingComponents": {
"navigation-bar": "/components/navigation-bar/navigation-bar"

},
"subPackages": [
{
Expand Down

This file was deleted.

106 changes: 0 additions & 106 deletions apps/vite-native/components/navigation-bar/navigation-bar.ts

This file was deleted.

64 changes: 0 additions & 64 deletions apps/vite-native/components/navigation-bar/navigation-bar.wxml

This file was deleted.

Empty file.
4 changes: 2 additions & 2 deletions apps/vite-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
"@tailwindcss/vite": "^4.0.4",
"autoprefixer": "^10.4.20",
"postcss": "^8.5.1",
"tailwindcss": "^4.0.3",
"tailwindcss": "^4.0.4",
"tailwindcss-injector": "workspace:*",
"weapp-tailwindcss": "workspace:*",
"weapp-vite": "^2.1.2"
"weapp-vite": "^2.1.3"
}
}
31 changes: 1 addition & 30 deletions apps/vite-native/pages/index/index.wxml
Original file line number Diff line number Diff line change
@@ -1,33 +1,4 @@
<!-- index.wxml -->
<template name="staffName">
<view class="text-red-800 bg-blue-400/40">FirstName: {{firstName}}, LastName: {{lastName}}</view>
</template>
<navigation-bar></navigation-bar>
<scroll-view scroll-y type="list">
{{ motto }}
<view class="bg-[#7d7ac2] text-[100px] text-[#123456] w-[323px] {{true?'h-[30px]':'h-[45px]'}}">111</view>
<view>{{message}}</view>
<view wx:for="{{array}}">{{item}}</view>
<template is="staffName" data="{{...staffA}}"></template>
<template is="staffName" data="{{...staffB}}"></template>
<template is="staffName" data="{{...staffC}}"></template>
<view>{{m1.message}}</view>
<wxs module="wxs" src="./test.wxs"></wxs>
<view id="tapTest" data-hi="Weixin" bindtap="{{wxs.tapName}}">Click me!</view>
<view class="bg-[#3a32d1] text-[100rpx] text-red-700 w-[323px] {{false?'h-[30px]':'h-[45px]'}}">222</view>
</scroll-view>
<template name="odd">
<view> odd </view>
</template>
<template name="even">
<view> even </view>
</template>

<block wx:for="{{[1, 2, 3, 4, 5]}}">
<template is="{{item % 2 == 0 ? 'even' : 'odd'}}"/>
</block>

<wxs module="m1">
var msg = "hello world";

module.exports.message = msg;
</wxs>
5 changes: 5 additions & 0 deletions packages/weapp-tailwindcss/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@layer theme, base, components, utilities;

@import './theme.css' layer(theme);
@import './preflight.css' layer(base);
@import './utilities.css' layer(utilities);
19 changes: 17 additions & 2 deletions packages/weapp-tailwindcss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
"require": "./dist/index.js",
"style": "./index.css"
},
"./escape": {
"types": "./dist/escape.d.ts",
Expand Down Expand Up @@ -95,11 +96,21 @@
"import": "./dist/types.mjs",
"require": "./dist/types.js"
},
"./package.json": "./package.json",
"./index.css": "./index.css",
"./index": "./index.css",
"./preflight.css": "./preflight.css",
"./preflight": "./preflight.css",
"./theme.css": "./theme.css",
"./theme": "./theme.css",
"./utilities.css": "./utilities.css",
"./utilities": "./utilities.css",
"./*": "./*"
},
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"style": "index.css",
"typesVersions": {
"*": {
"*": [
Expand All @@ -115,7 +126,11 @@
},
"files": [
"bin",
"dist"
"dist",
"index.css",
"preflight.css",
"theme.css",
"utilities.css"
],
"engines": {
"node": "^18.17.0 || >=20.5.0"
Expand Down
16 changes: 16 additions & 0 deletions packages/weapp-tailwindcss/preflight.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
2. Remove default margins and padding
3. Reset all borders.
*/

*,
::after,
::before,
::backdrop,
::file-selector-button {
box-sizing: border-box; /* 1 */
margin: 0; /* 2 */
padding: 0; /* 2 */
border: 0 solid; /* 3 */
}
Loading

0 comments on commit ce8851a

Please sign in to comment.