Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
"type": "string",
"description": "The name of the project to add tailwind to",
"$default": { "$source": "projectName" },
"x-prompt": "What project would you like to add Tailwind to?",
"pattern": "^[a-zA-Z].*$"
"x-prompt": "What project would you like to add Tailwind to?"
},
"skipFormat": {
"type": "boolean",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ exports[`setup-tailwind generator should add a tailwind config to an application
ScrollRestoration,
} from '@remix-run/react';
import type { MetaFunction, LinksFunction } from '@remix-run/node';
import twStyles from './tailwind.css';
import './tailwind.css';

export const meta: MetaFunction = () => [
{
Expand All @@ -52,7 +52,6 @@ export const meta: MetaFunction = () => [
];

export const links: LinksFunction = () => [
{ rel: 'stylesheet', href: twStyles },
{ rel: 'preconnect', href: 'https://fonts.googleapis.com' },
{
rel: 'preconnect',
Expand Down
3 changes: 1 addition & 2 deletions packages/remix/src/generators/setup-tailwind/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"$default": {
"$source": "projectName"
},
"x-prompt": "What project would you like to add Tailwind to?",
"pattern": "^[a-zA-Z].*$"
"x-prompt": "What project would you like to add Tailwind to?"
},
"skipFormat": {
"type": "boolean",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,34 @@ import {
installPackagesTask,
joinPathFragments,
readProjectConfiguration,
stripIndents,
type Tree,
} from '@nx/devkit';

import { upsertLinksFunction } from '../../utils/upsert-links-function';
import {
autoprefixerVersion,
postcssVersion,
tailwindVersion,
} from '../../utils/versions';
import type { SetupTailwindSchema } from './schema';
import { insertStatementAfterImports } from '../../utils/insert-statement-after-imports';

export default async function setupTailwind(
tree: Tree,
options: SetupTailwindSchema
) {
const project = readProjectConfiguration(tree, options.project);
if (project.projectType !== 'application') {
throw new Error(
`Project "${options.project}" is not an application. Please ensure the project is an application.`
);
}

generateFiles(tree, joinPathFragments(__dirname, 'files'), project.root, {
tpl: '',
});

const pathToRoot = joinPathFragments(project.root, 'app/root.tsx');
upsertLinksFunction(

insertStatementAfterImports(
tree,
pathToRoot,
'twStyles',
'./tailwind.css',
`{ rel: "stylesheet", href: twStyles }`
stripIndents`import './tailwind.css';`
);

addDependenciesToPackageJson(
Expand Down
61 changes: 0 additions & 61 deletions packages/remix/src/utils/upsert-links-function.spec.ts

This file was deleted.

51 changes: 0 additions & 51 deletions packages/remix/src/utils/upsert-links-function.ts

This file was deleted.

Loading