Skip to content

Commit 36ce1cc

Browse files
committed
Remove requirement to import style.css
1 parent bc0e6c5 commit 36ce1cc

File tree

7 files changed

+57
-39
lines changed

7 files changed

+57
-39
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Here's an example of how to use the `vue3-pull-to-refresh` component in your Vue
6060
<script setup lang="ts">
6161
//@ts-ignore
6262
import Vue3PullToRefresh from '@amirafa/vue3-pull-to-refresh';
63-
import '@amirafa/vue3-pull-to-refresh/dist/style.css';
63+
//import '@amirafa/vue3-pull-to-refresh/dist/style.css'; deprecated
6464
</script>
6565
```
6666
### Note on `@ts-ignore`
@@ -78,6 +78,10 @@ body {
7878

7979
## Changelog
8080

81+
### [Version 1.2.7] - 2024-11-06
82+
#### Updated
83+
- Remove requirement to import style.css
84+
8185
### [Version 1.2.2] - 2024-11-06
8286
#### Added
8387
- Github packages config

lib/Vue3PullToRefresh.vue

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
<script lang="ts" setup>
2424
import { computed, onMounted, onUnmounted, PropType, ref } from "vue";
25-
import "./style.css";
2625
2726
type OPTIONS = {
2827
color: string;
@@ -169,3 +168,38 @@ function normalizeDegrees(degrees: number) {
169168
return ((degrees % 360) + 360) % 360;
170169
}
171170
</script>
171+
172+
<style>
173+
.container {
174+
position: absolute;
175+
top: 0;
176+
right: 0;
177+
left: 0;
178+
bottom: 0;
179+
display: flex;
180+
justify-content: center;
181+
transition: all 70ms linear;
182+
}
183+
184+
.icon-container {
185+
position: absolute;
186+
padding: 4px;
187+
border-radius: 9999px;
188+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
189+
}
190+
191+
.transition-all {
192+
transition-property: all;
193+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
194+
transition-duration: 150ms;
195+
}
196+
197+
@keyframes spin {
198+
from {
199+
transform: rotate(0deg);
200+
}
201+
to {
202+
transform: rotate(360deg);
203+
}
204+
}
205+
</style>

lib/main.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import "./style.css";
21
import Vue3PullToRefresh from './Vue3PullToRefresh.vue';
32

43
export default Vue3PullToRefresh;

lib/style.css

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

package-lock.json

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"@vitejs/plugin-vue": "^3.1.0",
5050
"typescript": "^4.6.4",
5151
"vite": "^3.1.0",
52+
"vite-plugin-css-injected-by-js": "^3.5.2",
5253
"vue-tsc": "^0.40.4"
5354
}
5455
}

vite.config.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
import { resolve } from "path";
22
import { defineConfig } from "vite";
33
import vue from "@vitejs/plugin-vue";
4+
import cssInjectedByJs from "vite-plugin-css-injected-by-js";
45

56
export default defineConfig({
6-
plugins: [vue()],
7+
plugins: [vue(), cssInjectedByJs()],
78
build: {
89
lib: {
910
entry: resolve(__dirname, "lib/main.ts"),
10-
name: "Vue3PullToRefresh",
11+
name: "Vue3PulToRefresh",
1112
fileName: "vue3-pull-to-refresh",
1213
},
14+
cssCodeSplit: false,
1315
rollupOptions: {
1416
external: ["vue"],
1517
output: {
18+
manualChunks: undefined,
1619
globals: {
1720
vue: "Vue",
1821
},
19-
// Ensure that the styles are bundled if needed
20-
assetFileNames: "assets/[name]-[hash][extname]",
2122
},
2223
},
2324
},

0 commit comments

Comments
 (0)