vaderjs-native 1.0.13 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+
@@ -1,53 +0,0 @@
1
- //@ts-nocheck
2
- import fs from 'fs'
3
- import path from 'path'
4
-
5
- import type { VaderPlugin, VaderAPI } from "vaderjs/plugins";
6
- function checkIfTailwindInstalled() {
7
- try {
8
- //@ts-ignore
9
- require.resolve('tailwindcss')
10
- require.resolve('postcss')
11
- return true
12
- } catch (e) {
13
- return false
14
- }
15
- }
16
-
17
- function initTailwind() {
18
- const postcssConfig = path.resolve(process.cwd(), 'postcss.config.mjs')
19
- const tailwindCssFile = path.join(process.cwd(), '/public/styles.css')
20
- if(!fs.existsSync(tailwindCssFile)){
21
- fs.writeFileSync(tailwindCssFile, `@import "tailwindcss"`)
22
- }
23
- if (!fs.existsSync(postcssConfig)) {
24
- fs.writeFileSync(postcssConfig, `export default { plugins: { "@tailwindcss/postcss": {}, }}`)
25
-
26
- }
27
-
28
- }
29
-
30
-
31
- export default {
32
- name: 'tailwindcss',
33
- description: 'TailwindCSS plugin for Vader.js',
34
- version: '0.0.2',
35
- onBuildStart: async (vader) => {
36
- if (!checkIfTailwindInstalled()) {
37
- console.error('TailwindCSS is not installed. Please install it using `bun install tailwindcss @tailwindcss/postcss postcss-cli`\n more info: https://tailwindcss.com/docs/installation/using-postcss`')
38
- process.exit(1)
39
- }else{
40
- initTailwind()
41
- console.log('Building TailwindCSS...')
42
- await vader.runCommand(['bun', 'run', 'postcss', './public/styles.css', '-o', './public/tailwind_styles.css'])
43
- vader.injectHTML(`<link rel="stylesheet" href="./tailwind_styles.css">`)
44
-
45
- }
46
-
47
- return
48
- },
49
- onBuildFinish: async (vader) => {
50
- console.log('TailwindCSS plugin finished building')
51
- },
52
-
53
- } as VaderPlugin;