Bring back the CSS Configuration
This commit is contained in:
1573
package-lock.json
generated
1573
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -35,8 +35,6 @@
|
|||||||
"examples/characters",
|
"examples/characters",
|
||||||
"examples/accident-counter",
|
"examples/accident-counter",
|
||||||
"packages/css-configuration",
|
"packages/css-configuration",
|
||||||
"packages/utility-belt",
|
|
||||||
"examples/yearbook",
|
|
||||||
"examples/scratchpad",
|
"examples/scratchpad",
|
||||||
"examples/utility-belt",
|
"examples/utility-belt",
|
||||||
"examples/strictly-speaking",
|
"examples/strictly-speaking",
|
||||||
|
|||||||
4
packages/css-configuration/index.d.ts
vendored
Normal file
4
packages/css-configuration/index.d.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
/**
|
||||||
|
* @type import('vite').UserConfig['css']
|
||||||
|
*/
|
||||||
|
export const css: import('vite').UserConfig['css'];
|
||||||
42
packages/css-configuration/index.js
Normal file
42
packages/css-configuration/index.js
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
import nesting from 'tailwindcss/nesting/index.js';
|
||||||
|
import tailwindcss from 'tailwindcss';
|
||||||
|
import autoprefixer from 'autoprefixer';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type import('vite').UserConfig['css']
|
||||||
|
*/
|
||||||
|
export const css = {
|
||||||
|
postcss: {
|
||||||
|
plugins: [
|
||||||
|
tailwindcss({
|
||||||
|
content: ['./**/*.{html,js,jsx,ts,tsx}'],
|
||||||
|
theme: {
|
||||||
|
extend: {
|
||||||
|
container: {
|
||||||
|
center: true,
|
||||||
|
padding: '1rem',
|
||||||
|
},
|
||||||
|
colors: {
|
||||||
|
primary: {
|
||||||
|
50: '#f3faeb',
|
||||||
|
100: '#e5f3d4',
|
||||||
|
200: '#cde8ae',
|
||||||
|
300: '#acd87e',
|
||||||
|
400: '#8ec655',
|
||||||
|
500: '#6ca635',
|
||||||
|
600: '#558828',
|
||||||
|
700: '#426823',
|
||||||
|
800: '#375420',
|
||||||
|
900: '#30481f',
|
||||||
|
950: '#17270c',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
plugins: [],
|
||||||
|
}),
|
||||||
|
nesting,
|
||||||
|
autoprefixer,
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
26
packages/css-configuration/package.json
Normal file
26
packages/css-configuration/package.json
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"name": "css-configuration",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Some CSS settings for Vite/PostCSS that includes Tailwind",
|
||||||
|
"main": "index.js",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"types": "tsc --emitDeclarationOnly --allowJs --declaration --skipLibCheck index.js"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/stevekinney/testing-javascript.git"
|
||||||
|
},
|
||||||
|
"author": "Steve Kinney <hello@stevekinney.net>",
|
||||||
|
"license": "MIT",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/stevekinney/testing-javascript/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/stevekinney/testing-javascript#readme",
|
||||||
|
"devDependencies": {
|
||||||
|
"autoprefixer": "^10.4.20",
|
||||||
|
"tailwindcss": "^3.4.12",
|
||||||
|
"typescript": "^5.6.2",
|
||||||
|
"vite": "^5.4.6"
|
||||||
|
}
|
||||||
|
}
|
||||||
7
packages/utility-belt/index.d.ts
vendored
Normal file
7
packages/utility-belt/index.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
export type RequireOnly<T, Keys extends keyof T = keyof T> = Partial<T> &
|
||||||
|
Required<Pick<T, Keys>>;
|
||||||
|
export declare const isError: (error: unknown) => error is Error;
|
||||||
|
export declare const getErrorMessage: (
|
||||||
|
error: unknown,
|
||||||
|
defaultMessage: string,
|
||||||
|
) => string;
|
||||||
16
packages/utility-belt/index.js
Normal file
16
packages/utility-belt/index.js
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {unknown} error The error object to check.
|
||||||
|
* @returns {error is Error}
|
||||||
|
*/
|
||||||
|
export const isError = (error) => error instanceof Error;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the error message from an error object or return a default message.
|
||||||
|
* @param {unknown} error The error object to check.
|
||||||
|
* @param {string} defaultMessage The default message to return if the error is not an instance of Error.
|
||||||
|
* @returns {string} The error message or the default message.
|
||||||
|
*/
|
||||||
|
export const getErrorMessage = (error, defaultMessage) => {
|
||||||
|
return isError(error) ? error.message : defaultMessage;
|
||||||
|
};
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "scratchpad",
|
"name": "utility-belt",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
|
"description": "Some little utilities",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "vitest --ui",
|
"types": "tsc --emitDeclarationOnly --allowJs --declaration --skipLibCheck index.js"
|
||||||
"test": "vitest"
|
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -18,8 +18,6 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/stevekinney/testing-javascript#readme",
|
"homepage": "https://github.com/stevekinney/testing-javascript#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitest/ui": "^2.1.1",
|
"typescript": "^5.6.2"
|
||||||
"vite": "^5.4.5",
|
|
||||||
"vitest": "^2.1.1"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user