-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
3,709 additions
and
1,554 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
shared-workspace-lockfile=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
install-strategy=shallow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta | ||
name="viewport" | ||
content="width=device-width, initial-scale=1.0" | ||
/> | ||
<title>Vite with Tailwind CSS</title> | ||
<link href="dist/theme.css" rel="stylesheet" /> | ||
</head> | ||
<body> | ||
<h1 class="text-neutral-10">Test Heading</h1> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
import fs from 'fs' | ||
import { exec } from 'child_process' | ||
import readline from 'readline' | ||
|
||
const isNotDevEnvironment = | ||
!process.env.INIT_CWD || process.env.INIT_CWD !== process.cwd() | ||
|
||
const createTailwindConfig = (rl) => { | ||
const tailwindConfigContent = `/** @type {import('tailwindcss').Config} */ | ||
const ntTheme = require('nt-stylesheet/dist/theme.cjs'); | ||
module.exports = { | ||
content: ['*.{html,js}'], | ||
theme: { | ||
extend: ntTheme.theme.extend, | ||
}, | ||
plugins: [], | ||
}; | ||
` | ||
fs.writeFile( | ||
'tailwind.config.js', | ||
tailwindConfigContent, | ||
(writeError) => { | ||
if (writeError) { | ||
console.error( | ||
`Error writing tailwind.config.js: ${writeError.message}`, | ||
) | ||
rl.close() | ||
return | ||
} | ||
console.log( | ||
'tailwind.config.js has been initialized and customized successfully!', | ||
) | ||
rl.close() | ||
}, | ||
) | ||
} | ||
|
||
const createPostCSSConfig = (rl) => { | ||
const postcssConfigContent = `module.exports = { | ||
plugins: { | ||
'postcss-import': {}, | ||
'tailwindcss/nesting': 'postcss-nesting', | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
}, | ||
}; | ||
` | ||
|
||
fs.writeFile( | ||
'postcss.config.js', | ||
postcssConfigContent, | ||
(writeError) => { | ||
if (writeError) { | ||
console.error( | ||
`Error writing postcss.config.js: ${writeError.message}`, | ||
) | ||
rl.close() | ||
return | ||
} | ||
console.log( | ||
'postcss.config.js has been created successfully!', | ||
) | ||
rl.close() | ||
}, | ||
) | ||
} | ||
|
||
if (!isNotDevEnvironment) { | ||
const rl = readline.createInterface({ | ||
input: process.stdin, | ||
output: process.stdout, | ||
}) | ||
|
||
rl.question( | ||
'Do you want to initialize Tailwind CSS? (y/n) ', | ||
(answer) => { | ||
if (answer.toLowerCase() === 'y') { | ||
exec('npx tailwindcss init', (error, _, stderr) => { | ||
if (error) { | ||
console.error( | ||
`Error initializing Tailwind CSS: ${error.message}`, | ||
) | ||
rl.close() | ||
return | ||
} | ||
if (stderr) { | ||
console.error( | ||
`Error initializing Tailwind CSS: ${stderr}`, | ||
) | ||
rl.close() | ||
return | ||
} | ||
|
||
createTailwindConfig(rl) | ||
createPostCSSConfig(rl) | ||
}) | ||
} else { | ||
console.log('Tailwind CSS initialization skipped.') | ||
rl.close() | ||
} | ||
}, | ||
) | ||
} else { | ||
console.log( | ||
'Development environment detected, skipping Tailwind CSS initialization.', | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import './styles/styles.scss' | ||
|
||
import ntTheme from './themes' | ||
|
||
export default ntTheme |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,42 @@ | ||
{ | ||
"name": "nt-stylesheet", | ||
"version": "1.0.5-rc.4", | ||
"version": "1.1.0", | ||
"description": "", | ||
"packageManager": "[email protected]", | ||
"scripts": { | ||
"build:css": "pnpm exec postcss src/styles.scss -o dist/styles.css", | ||
"publish:css": "pnpm rollup -c && npm publish dist/apps/nt-stylesheet" | ||
"postinstall": "node init-tailwind.js", | ||
"build": "pnpm vite build" | ||
}, | ||
"engines": { | ||
"node": "20" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"type": "module", | ||
"files": [ | ||
"dist" | ||
], | ||
"main": "./dist/theme.umd.cjs", | ||
"module": "./dist/theme.js", | ||
"exports": { | ||
".": { | ||
"import": "./dist/theme.js", | ||
"require": "./dist/theme.umd.cjs" | ||
} | ||
}, | ||
"devDependencies": { | ||
"@types/node": "20.4.9", | ||
"autoprefixer": "^10.4.20", | ||
"nx": "^20.0.5", | ||
"postcss": "^8.4.49", | ||
"postcss-import": "^16.1.0", | ||
"tailwindcss": "^3.4.0", | ||
"typescript": "^5.6.3" | ||
"nx": "^20.2.2", | ||
"typescript": "^5.7.2", | ||
"vite": "^6.0.3", | ||
"vite-plugin-sass-dts": "^1.3.29" | ||
}, | ||
"dependencies": { | ||
"postcss-nesting": "^13.0.1" | ||
"postcss": "^8.4.49", | ||
"autoprefixer": "^10.4.20", | ||
"postcss-import": "^16.1.0", | ||
"postcss-nesting": "^13.0.1", | ||
"tailwindcss": "^3.4.16" | ||
} | ||
} |
Oops, something went wrong.